Class: CosmographCrossfilter
Combines the two state inputs and produces the highlight set per side:
- User selection — user-driven JS Set (
_userSelectedPointIndices/_userSelectedLinkIndices), mutated by the publicselect*/unselect*methods on Cosmograph. - Selection — mosaic clause collectors (
_pointsSelection/_linksSelection) that any Mosaic clause source (filter widgets, vgplot interactors, custom Mosaic clients) publishes into.
On every change _recomputeHighlight re-resolves both sides through
composePredicates, computes the highlight sets, pushes them to
@cosmos.gl/graph, dispatches the dataFiltered event, and fires the
onPointsFiltered / onLinksFiltered callbacks.
Constructors
Constructor
new CosmographCrossfilter(
_):CosmographCrossfilter
Parameters
| Parameter | Type |
|---|---|
_ | ICosmographInternalApi |
Returns
CosmographCrossfilter
Accessors
highlightedPointIndices
Get Signature
get highlightedPointIndices():
ReadonlySet<number>
Returns
ReadonlySet<number>
highlightedLinkIndices
Get Signature
get highlightedLinkIndices():
ReadonlySet<number>
Returns
ReadonlySet<number>
pointsSelection
Get Signature
get pointsSelection():
Selection
Returns
Selection
linksSelection
Get Signature
get linksSelection():
Selection
Returns
Selection
isHighlightActive
Get Signature
get isHighlightActive():
boolean
True when any input is active — a Mosaic clause or a user selection on either side.
Returns
boolean
pointsUserActive
Get Signature
get pointsUserActive():
boolean
True when the user has acted on the points side (even if the resulting Set is empty).
Returns
boolean
linksUserActive
Get Signature
get linksUserActive():
boolean
True when the user has acted on the links side (even if the resulting Set is empty).
Returns
boolean
isPointsHighlightActive
Get Signature
get isPointsHighlightActive():
boolean
True when the points side resolved to an active highlight — from a Mosaic clause on pointsSelection, the user selection, or the endpoint subquery driven by a clause on linksSelection.
Returns
boolean
isLinksHighlightActive
Get Signature
get isLinksHighlightActive():
boolean
True when the links side resolved to an active highlight.
Returns
boolean
userSelectedPointIndices
Get Signature
get userSelectedPointIndices():
ReadonlySet<number>
The user-driven point selection (live reference, read-only).
Returns
ReadonlySet<number>
userSelectedLinkIndices
Get Signature
get userSelectedLinkIndices():
ReadonlySet<number>
The user-driven link selection (live reference, read-only).
Returns
ReadonlySet<number>
Methods
isPointHighlighted()
isPointHighlighted(
pointIndex):boolean
Whether a point is currently highlighted. When the points side is inactive, every point is treated as highlighted.
Parameters
| Parameter | Type |
|---|---|
pointIndex | number |
Returns
boolean
setUserSelectedPointIndices()
setUserSelectedPointIndices(
indices?):void
Replace the user-driven point selection.
null: passive reset — flag becomes false (no user constraint).[]: active empty — flag stays/becomes true with empty Set (dim the side).- non-empty: flag becomes true with the Set populated.
Parameters
| Parameter | Type |
|---|---|
indices? | number[] | null |
Returns
void
addUserSelectedPointIndices()
addUserSelectedPointIndices(
indices):void
Append indices to the user-driven point selection. Empty input is a no-op (flag unchanged).
Parameters
| Parameter | Type |
|---|---|
indices | number[] |
Returns
void
removeUserSelectedPointIndices()
removeUserSelectedPointIndices(
indices):void
Remove indices from the point selection. On a passive-empty Set (size === 0 and
not yet user-active), fills the Set with the complement — allPoints ∖ indices — AND
seeds the link Set with allLinks when that side is also passive-empty. On an
active-empty Set (user already narrowed to zero), this is a no-op.
Parameters
| Parameter | Type |
|---|---|
indices | number[] |
Returns
void
clearUserSelectedPointIndices()
clearUserSelectedPointIndices():
void
Clear the user-driven point selection (passive reset — flag becomes false).
Returns
void
setUserSelectedLinkIndices()
setUserSelectedLinkIndices(
indices?):void
Replace the user-driven link selection. null is passive reset; [] is active empty;
non-empty populates the Set. See setUserSelectedPointIndices.
Parameters
| Parameter | Type |
|---|---|
indices? | number[] | null |
Returns
void
addUserSelectedLinkIndices()
addUserSelectedLinkIndices(
indices):void
Append indices to the user-driven link selection. Empty input is a no-op (flag unchanged).
Parameters
| Parameter | Type |
|---|---|
indices | number[] |
Returns
void
removeUserSelectedLinkIndices()
removeUserSelectedLinkIndices(
indices):void
Remove indices from the link selection. Passive-empty → complement-fill (and symmetric
seed of the point side when that side is also passive-empty). Active-empty → no-op.
See removeUserSelectedPointIndices.
Parameters
| Parameter | Type |
|---|---|
indices | number[] |
Returns
void
clearUserSelectedLinkIndices()
clearUserSelectedLinkIndices():
void
Clear the user-driven link selection (passive reset — flag becomes false).
Returns
void