@twinfinity/core
    Preparing search index...

    Interface LineSource

    A contributor of segment data to a LineAggregator. One source = one T8LDData adapter, one slicer pass, one debug overlay — anything that owns a slab and a visibility/style state.

    Identity is by reference: the aggregator holds the source pointer in a Set. id is for diagnostics and is the consumer's responsibility to make unique (or not, if duplicates don't matter to them).

    Mutation surface is small and self-signalling. Every mutation that affects what the renderer should draw flows through one of:

    • visible = ... setter
    • styleOverride = ... setter
    • renderingGroupId = ... setter
    • setSlab(newSlab) — replaces content
    • markContentDirty() — for in-place edits to getSlab() arrays

    Forgetting to call markContentDirty() after an in-place mutation is the one footgun. Callers that don't need in-place mutation should use setSlab() exclusively.

    getSlab() returns the source's canonical storage. Callers may mutate the returned typed arrays in place but MUST call markContentDirty() afterwards. The aggregator caches the reference and only re-emits when dirty.

    Change signalling is the only aggregator contract. Each of the mutations above fires onChanged; the aggregator subscribes to schedule a rebuild and unsubscribes on removeSource. There are no other hooks the aggregator needs — implementers expose an Observable and notify it, the idiomatic Babylon way, rather than satisfying private bookkeeping methods.

    interface LineSource {
        id: string;
        onChanged: Observable<void>;
        renderingGroupId: number;
        styleOverride: null | OverridableStyle;
        transform: null | Matrix;
        visible: boolean;
        dispose(): void;
        getSlab(): SegmentSlab;
        markContentDirty(): void;
        markTransformDirty(): void;
        setSlab(slab: SegmentSlab): void;
    }
    Index

    Properties

    id: string

    Diagnostic label. Used in aggregator validation errors.

    onChanged: Observable<void>

    Fires whenever a mutation changes what the renderer should draw (content, visibility, style override, group, or transform). The aggregator subscribes here in addSource to schedule a rebuild and removes its observer in removeSource. Consumers normally don't subscribe; it's the source→aggregator change channel.

    renderingGroupId: number

    Rendering group this source draws into. The aggregator produces one combined slab per group; each group is rendered by its own LineRenderer instance. Within a group, sources draw in addSource order. Defaults to 0.

    Setter schedules an aggregator rebuild.

    styleOverride: null | OverridableStyle

    Optional per-source style override. Applied during aggregation; the renderer never sees the source's "raw" colour/width/linetype for overridden fields. Composes with the renderer's global override (which applies at draw time as a uniform on top of whatever the slab contains).

    Setter schedules an aggregator rebuild.

    transform: null | Matrix

    Per-source transform matrix applied at combine time. null (default) means identity (no transform). The aggregator transforms each of the source's segment positions when copying into the combined buffer — so the slab itself stays untouched and changing the transform doesn't trigger a slab rebuild, only a cheap aggregator re-combine.

    Used by BimDrawing to lift a floor plan to its storey elevation (helper BimDrawing.yOffset), and available for rotation / scaling / mirroring use cases by setting the matrix directly.

    The setter compares by reference, so assigning a fresh Matrix schedules a rebuild but re-assigning the same instance after mutating it in place does not — call markTransformDirty for the in-place case.

    visible: boolean

    Whether this source's contribution should appear in the next render. Setter schedules an aggregator rebuild.

    Methods

    • Permanently remove this source. After dispose, further mutations are no-ops and onChanged observers are cleared.

      Returns void

    • Returns this source's canonical slab. The aggregator caches the reference between rebuilds and only re-reads when the source signals dirty (via setSlab, markContentDirty, or initial registration).

      Returns SegmentSlab

    • Signal that the slab returned by getSlab() has been mutated in place (e.g., a bulk producer rewriting typed-array contents). Schedules a rebuild. Not needed when content was replaced via setSlab().

      Returns void

    • Signal that the transform matrix was mutated in place (rather than replaced with a fresh Matrix). Schedules a rebuild and invalidates the aggregator's cached frustum corners. Not needed when a new Matrix was assigned via the transform setter — that's detected by reference.

      Returns void

    • Replace this source's slab with a new one. Schedules a rebuild.

      Parameters

      Returns void