OrbPro2 a Cesium distribution

EntityMemberView

A read-only 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

static Cesium.EntityMemberView.create

Builds a view over a dense array and a set of packed segments.

static Cesium.EntityMemberView.resolveSegment

Re-resolves a segment's alive ordinals against its block as it is now.

static Cesium.EntityMemberView.segmentOf

Builds a segment over one slot range of a block.

static Cesium.EntityMemberView.slotSegmentOf

Builds a segment over an explicit list of slots - the shape a region or attribute selection takes.

static Cesium.EntityMemberView.viewsExist : boolean

Whether any view has been built in this realm.

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>

The ORDINARY members of a list: the list itself when it is a plain array.

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:
The ordinary members.

static Cesium.EntityMemberView.isView(list)boolean

Whether a list is a view rather than a plain array.
Name Type Description
list Array.<Entity> The list.
Returns:
Whether it is a view.

static Cesium.EntityMemberView.lengthOf(list)number

The number of members a list holds without touching any of them.
Name Type Description
list Array.<Entity> The list.
Returns:
The length.

static Cesium.EntityMemberView.packedSegmentsOf(list)Array.<EntityMemberView.Segment>

The packed runs of a list, empty for a plain array.
Name Type Description
list Array.<Entity> The list.
Returns:
The runs.

static Cesium.EntityMemberView.segmentsForKind(list, kind)Array.<EntityMemberView.Segment>

The packed runs of a list that carry a graphics kind.
Name Type Description
list Array.<Entity> The list.
kind number The EntityGraphicsKind bit.
Returns:
The matching runs.

static Cesium.EntityMemberView.snapshotOf(list)Array.<Entity>

A SNAPSHOT copy of a list, taken without materializing anything.

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:
The snapshot.

Type Definitions

Cesium.EntityMemberView.Segment

One run of members inside one 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.
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.