Skip to content
Snippets Groups Projects
Commit 157f51d9 authored by Alexander Rose's avatar Alexander Rose
Browse files

added spacefill repr

parent f62a431e
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ import { CartoonRepresentationProvider } from './representation/cartoon'; ...@@ -10,6 +10,7 @@ import { CartoonRepresentationProvider } from './representation/cartoon';
import { BallAndStickRepresentationProvider } from './representation/ball-and-stick'; import { BallAndStickRepresentationProvider } from './representation/ball-and-stick';
import { MolecularSurfaceRepresentationProvider } from './representation/molecular-surface'; import { MolecularSurfaceRepresentationProvider } from './representation/molecular-surface';
import { CarbohydrateRepresentationProvider } from './representation/carbohydrate'; import { CarbohydrateRepresentationProvider } from './representation/carbohydrate';
import { SpacefillRepresentationProvider } from './representation/spacefill';
export class StructureRepresentationRegistry extends RepresentationRegistry<Structure> { export class StructureRepresentationRegistry extends RepresentationRegistry<Structure> {
constructor() { constructor() {
...@@ -24,8 +25,9 @@ export class StructureRepresentationRegistry extends RepresentationRegistry<Stru ...@@ -24,8 +25,9 @@ export class StructureRepresentationRegistry extends RepresentationRegistry<Stru
export const BuiltInStructureRepresentations = { export const BuiltInStructureRepresentations = {
'cartoon': CartoonRepresentationProvider, 'cartoon': CartoonRepresentationProvider,
'ball-and-stick': BallAndStickRepresentationProvider, 'ball-and-stick': BallAndStickRepresentationProvider,
'molecular-surface': MolecularSurfaceRepresentationProvider,
'carbohydrate': CarbohydrateRepresentationProvider, 'carbohydrate': CarbohydrateRepresentationProvider,
'molecular-surface': MolecularSurfaceRepresentationProvider,
'spacefill': SpacefillRepresentationProvider,
} }
export type BuiltInStructureRepresentationsName = keyof typeof BuiltInStructureRepresentations export type BuiltInStructureRepresentationsName = keyof typeof BuiltInStructureRepresentations
export const BuiltInStructureRepresentationsNames = Object.keys(BuiltInStructureRepresentations) export const BuiltInStructureRepresentationsNames = Object.keys(BuiltInStructureRepresentations)
......
// /** /**
// * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
// * *
// * @author Alexander Rose <alexander.rose@weirdbyte.de> * @author Alexander Rose <alexander.rose@weirdbyte.de>
// */ */
// import { ElementSphereVisual, ElementSphereParams } from '../visual/element-sphere'; import { ElementSphereVisual, ElementSphereParams } from '../visual/element-sphere';
// import { UnitsRepresentation } from '../units-representation'; import { UnitsRepresentation } from '../units-representation';
// import { ParamDefinition as PD } from 'mol-util/param-definition'; import { ParamDefinition as PD } from 'mol-util/param-definition';
// import { StructureRepresentation } from '../representation'; import { StructureRepresentation, StructureRepresentationProvider } from '../representation';
// import { Representation } from 'mol-repr/representation'; import { RepresentationParamsGetter, RepresentationContext, Representation } from 'mol-repr/representation';
// import { ThemeRegistryContext } from 'mol-theme/theme'; import { ThemeRegistryContext } from 'mol-theme/theme';
// import { Structure } from 'mol-model/structure'; import { Structure } from 'mol-model/structure';
import { UnitKind, UnitKindOptions } from '../visual/util/common';
// export const SpacefillParams = { const SpacefillVisuals = {
// ...ElementSphereParams, 'element-sphere': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, ElementSphereParams>) => UnitsRepresentation('Sphere mesh', ctx, getParams, ElementSphereVisual),
// } }
// export function getSpacefillParams(ctx: ThemeRegistryContext, structure: Structure) {
// return SpacefillParams // TODO return copy
// }
// export type SpacefillProps = PD.DefaultValues<typeof SpacefillParams>
// export type SpacefillRepresentation = StructureRepresentation<SpacefillProps> export const SpacefillParams = {
...ElementSphereParams,
unitKinds: PD.MultiSelect<UnitKind>(['atomic', 'gaussians'], UnitKindOptions),
}
export type SpacefillParams = typeof SpacefillParams
export function getSpacefillParams(ctx: ThemeRegistryContext, structure: Structure) {
return PD.clone(SpacefillParams)
}
// export function SpacefillRepresentation(defaultProps: SpacefillProps): SpacefillRepresentation { export type SpacefillRepresentation = StructureRepresentation<SpacefillParams>
// return Representation.createMulti('Spacefill', defaultProps, [ export function SpacefillRepresentation(ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, SpacefillParams>): SpacefillRepresentation {
// UnitsRepresentation('Sphere mesh', defaultProps, ElementSphereVisual) return Representation.createMulti('Spacefill', ctx, getParams, SpacefillVisuals as unknown as Representation.Def<Structure, SpacefillParams>)
// ]) }
// }
\ No newline at end of file export const SpacefillRepresentationProvider: StructureRepresentationProvider<typeof SpacefillParams> = {
label: 'Spacefill',
description: 'Displays atoms as spheres.',
factory: SpacefillRepresentation,
getParams: getSpacefillParams,
defaultValues: PD.getDefaultValues(SpacefillParams),
defaultColorTheme: 'element-symbol',
defaultSizeTheme: 'physical'
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment