You can create your own CZML properties and hook them into the DataSource system without modifying any of the Cesium code.
The cesium-sensors plugin does just that - we add processing for CZML properties like
agi_conicSensor, etc. along with corresponding Graphics, Visualizers, and Primitives.
Here’s an overview of the architecture of the DataSources layer in Cesium:
Entity - this object groups related graphics definitions together. The properties containing each built-in graphics type are listed in the class for performance reasons, but it also provides an
addProperty function which can define additional custom properties that work the same way as the built-in properties. Specifically, an entity property needs to raise the
definitionChanged event on the entity when the property changes.
Graphics - these store the definitional information describing how graphical properties change as a function of time. For example, an entity’s position property is typically a sampled property which interpolates an object’s position over time. Or, a property’s value could be fixed with respect to time, for example, a color property might be constant, while the show property or other properties may change over time.
Visualizer - these objects bridge the gap between the graphics and the actual Cesium primitives that are drawn in the scene. These objects know about a particular type of graphics, and each frame, they evaluate the current values of each of the definitional graphical properties at the current time, and then configure the primitives to match. Because this process runs each frame, there are a lot of performance optimizations in place in the built-in visualizers to avoid unnecessary calculations. As a very basic example, if a graphics’
show property is false, there’s no need to even calculate the value of other properties.
CzmlDataSource - this interprets data from CZML packets and constructs appropriate graphical properties and fills them with data. This may mean replacing properties with new definitions, or adding new samples or time intervals to an existing property.
Essentially, you can think of the Graphics properties as being stateless data-driven functions of time, f(t) -> v, while the primitives have no knowledge of time, so the visualizers evaluate the functions at the current time, and then apply those values onto the primitives (which are stateful) to be rendered.
The plugin points for each of these systems are:
CzmlDataSource.updaters is an array of functions which are called with each incoming packet, to load the data into the entity’s properties. You can add your own processing functions to this array.
DataSourceDisplay.defaultVisualizersCallback is a function that constructs an array of visualizers for a given data source and scene. You can wrap this function and construct and add your own visualizers to the array.
addProperty defines an additional custom property. Typically you’ll call this from within the CzmlDataSource processing functions to create properties as needed.