Entity[] over a collection's ordinary members AND
its packed sites, where a packed site becomes an Entity only when
something actually reads it.
A Proxy over an Array target, so Array.isArray is true,
view[i], for...of, spread and every
Array.prototype read method work exactly as they do on the
stock values array. indexOf,
lastIndexOf, includes and slice are
answered from the segment table without materializing anything;
filter, map, forEach and the rest
materialize each member as they visit it, which is the caller's explicit
choice and costs an ordinary Entity per member retained.
The view a collection hands out through values is LIVE: it
follows blocks added, blocks dropped and sites removed, so a reference the
caller keeps behaves exactly like the stock array it replaces - one object
for the life of the collection, always reporting the membership as it is
now.
A collection with no packed blocks never builds one of these: its
values is the same array object it always was.
Members
A PLAIN data property, deliberately: it is read once at the top of every
visualizer's _onCollectionChanged, nine visualizers deep, for
every membership and definition change in the engine. A data-property read
and a branch is what an application that never packs anything pays for this
whole layer; a getter, or three denseOf calls, measured
+3.4 ns per dispatch against stock.
Monotonic. A flag that could go back to false would have to be cleared correctly at every site that drops a block, and clearing it one moment too early hands a visualizer a live view it will walk - a million materializations and roughly 3.4 GB, silently.
Methods
static Cesium.EntityMemberView.denseOf(list) → Array.<Entity>
This is the one line every visualizer needs. A visualizer that draws something a packed site does not carry must not walk the packed segments - walking them would materialize a million entities to discover there is nothing to draw.
| Name | Type | Description |
|---|---|---|
list |
Array.<Entity> | The list. |
Returns:
| Name | Type | Description |
|---|---|---|
list |
Array.<Entity> | The list. |
Returns:
| Name | Type | Description |
|---|---|---|
list |
Array.<Entity> | The list. |
Returns:
static Cesium.EntityMemberView.packedSegmentsOf(list) → Array.<EntityMemberView.Segment>
| Name | Type | Description |
|---|---|---|
list |
Array.<Entity> | The list. |
Returns:
static Cesium.EntityMemberView.segmentsForKind(list, kind) → Array.<EntityMemberView.Segment>
| Name | Type | Description |
|---|---|---|
list |
Array.<Entity> | The list. |
kind |
number |
The EntityGraphicsKind bit. |
Returns:
static Cesium.EntityMemberView.snapshotOf(list) → Array.<Entity>
The engine takes deferred copies of member lists - zoomTo holds
one across a promise, then walks it - and slice(0) is the stock
way to do it. On a view that would materialize every member up front, which
for a million-site collection is roughly 3.4 GB before the first bounding
sphere is computed. This returns a lazy sub-view for a view and an ordinary
slice(0) for a plain array, so both callers get a list that
cannot change under them and neither pays for members it never reads.
| Name | Type | Description |
|---|---|---|
list |
Array.<Entity> | The list. |
Returns:
Type Definitions
PackedEntityBlock.
Properties:
| Name | Type | Description |
|---|---|---|
block |
PackedEntityBlock | The block that owns the sites. |
first |
number | The first SLOT of the run. |
count |
number | The number of SLOTS in the run, tombstones included. |
aliveBase |
number | The number of live sites of the block below first. |
aliveCount |
number | The number of live sites inside the run - how many MEMBERS it contributes. |
graphicsMask |
number | The EntityGraphicsKind bits every site in the run carries. |