/** * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose */ import { Task } from 'mol-task' import { RenderObject } from 'mol-gl/render-object'; import { RepresentationProps, Representation } from '..'; import { VolumeData } from 'mol-model/volume'; import { PickingId } from '../../util/picking'; import { Loci } from 'mol-model/loci'; import { MarkerAction } from '../../util/marker-data'; export interface VolumeElementRepresentation

{ renderObjects: ReadonlyArray create: (volumeData: VolumeData, props: P) => Task update: (props: P) => Task getLoci: (pickingId: PickingId) => Loci | null mark: (loci: Loci, action: MarkerAction) => void } export interface VolumeRepresentation

extends Representation { } export function VolumeRepresentation

(reprCtor: () => VolumeElementRepresentation

): VolumeRepresentation

{ const renderObjects: RenderObject[] = [] return { renderObjects, create(volumeData: VolumeData, props: P = {} as P) { return Task.create('VolumeRepresentation.create', async ctx => { const repr = reprCtor() await repr.create(volumeData, props).runAsChild(ctx, { message: 'Building volume representation...', current: 0, max: 1 }); renderObjects.push(...repr.renderObjects) }); }, update(props: P) { return Task.create('VolumeRepresentation.update', async ctx => {}) }, getLoci(pickingId: PickingId) { // TODO return null }, mark(loci: Loci, action: MarkerAction) { // TODO } } }