Skip to content
Snippets Groups Projects
index.ts 3.16 KiB
Newer Older
Alexander Rose's avatar
Alexander Rose committed
/**
 * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
 *
 * @author Alexander Rose <alexander.rose@weirdbyte.de>
 * @author David Sehnal <david.sehnal@gmail.com>
Alexander Rose's avatar
Alexander Rose committed
 */

import { Structure } from 'mol-model/structure';
import { ColorThemeName, ColorThemeOptions } from 'mol-theme/color';
import { SizeThemeName, SizeThemeOptions } from 'mol-theme/size';
import { Representation, RepresentationProps } from '..';
import { SelectParam, paramDefaultValues } from 'mol-util/parameter';
import { Geometry } from 'mol-geo/geometry/geometry';
import { Mesh } from 'mol-geo/geometry/mesh/mesh';
import { Points } from 'mol-geo/geometry/points/points';
import { Lines } from 'mol-geo/geometry/lines/lines';
import { DirectVolume } from 'mol-geo/geometry/direct-volume/direct-volume';
export interface StructureRepresentation<P extends RepresentationProps = {}> extends Representation<Structure, P> { }
// export interface  StructureVisual<P extends RepresentationProps = {}> extends Visual<Structure, P> { }


Alexander Rose's avatar
Alexander Rose committed
export const StructureParams = {
    ...Geometry.Params,
    colorTheme: SelectParam<ColorThemeName>('Color Theme', '', 'polymer-index', ColorThemeOptions),
Alexander Rose's avatar
Alexander Rose committed
    sizeTheme: SelectParam<SizeThemeName>('Size Theme', '', 'physical', SizeThemeOptions),
Alexander Rose's avatar
Alexander Rose committed
export const DefaultStructureProps = paramDefaultValues(StructureParams)
export type StructureProps = typeof DefaultStructureProps

Alexander Rose's avatar
Alexander Rose committed
export const StructureMeshParams = {
    ...Mesh.Params,
    ...StructureParams,
Alexander Rose's avatar
Alexander Rose committed
export const DefaultStructureMeshProps = paramDefaultValues(StructureMeshParams)
export type StructureMeshProps = typeof DefaultStructureMeshProps
Alexander Rose's avatar
Alexander Rose committed
export const StructurePointsParams = {
    ...Points.Params,
    ...StructureParams,
Alexander Rose's avatar
Alexander Rose committed
export const DefaultStructurePointsProps = paramDefaultValues(StructurePointsParams)
Alexander Rose's avatar
Alexander Rose committed
export type StructurePointsProps = typeof DefaultStructurePointsProps

Alexander Rose's avatar
Alexander Rose committed
export const StructureLinesParams = {
    ...Lines.Params,
    ...StructureParams,
Alexander Rose's avatar
Alexander Rose committed
}
Alexander Rose's avatar
Alexander Rose committed
export const DefaultStructureLinesProps = paramDefaultValues(StructureLinesParams)
Alexander Rose's avatar
Alexander Rose committed
export type StructureLinesProps = typeof DefaultStructureLinesProps
export const StructureDirectVolumeParams = {
    ...StructureParams,
}
export const DefaultStructureDirectVolumeProps = paramDefaultValues(StructureDirectVolumeParams)
export type StructureDirectVolumeProps = typeof DefaultStructureDirectVolumeProps

export interface VisualUpdateState {
Alexander Rose's avatar
Alexander Rose committed
    updateColor: boolean
    updateSize: boolean
    createGeometry: boolean
Alexander Rose's avatar
Alexander Rose committed
}
export namespace VisualUpdateState {
    export function create(): VisualUpdateState {
Alexander Rose's avatar
Alexander Rose committed
        return {
Alexander Rose's avatar
Alexander Rose committed
            updateColor: false,
            updateSize: false,
            createGeometry: false
Alexander Rose's avatar
Alexander Rose committed
        }
    }
    export function reset(state: VisualUpdateState) {
        state.updateTransform = false
Alexander Rose's avatar
Alexander Rose committed
        state.updateColor = false
        state.updateSize = false
        state.createGeometry = false
Alexander Rose's avatar
Alexander Rose committed
    }
}

export { ComplexRepresentation } from './complex-representation'
export { UnitsRepresentation } from './units-representation'
export { ComplexVisual } from './complex-visual'
export { UnitsVisual } from './units-visual'