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

registered carbohydrate representation

parent 61a2602c
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ import { RepresentationProvider, RepresentationRegistry } from '../representatio ...@@ -9,6 +9,7 @@ import { RepresentationProvider, RepresentationRegistry } from '../representatio
import { CartoonRepresentationProvider } from './representation/cartoon'; 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';
export class StructureRepresentationRegistry extends RepresentationRegistry<Structure> { export class StructureRepresentationRegistry extends RepresentationRegistry<Structure> {
constructor() { constructor() {
...@@ -24,6 +25,7 @@ export const BuiltInStructureRepresentations = { ...@@ -24,6 +25,7 @@ export const BuiltInStructureRepresentations = {
'cartoon': CartoonRepresentationProvider, 'cartoon': CartoonRepresentationProvider,
'ball-and-stick': BallAndStickRepresentationProvider, 'ball-and-stick': BallAndStickRepresentationProvider,
'molecular-surface': MolecularSurfaceRepresentationProvider, 'molecular-surface': MolecularSurfaceRepresentationProvider,
'carbohydrate': CarbohydrateRepresentationProvider,
} }
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 { CarbohydrateSymbolVisual, CarbohydrateSymbolParams } from '../visual/carbohydrate-symbol-mesh'; import { CarbohydrateSymbolVisual, CarbohydrateSymbolParams } from '../visual/carbohydrate-symbol-mesh';
// import { CarbohydrateLinkVisual, CarbohydrateLinkParams } from '../visual/carbohydrate-link-cylinder'; import { CarbohydrateLinkVisual, CarbohydrateLinkParams } from '../visual/carbohydrate-link-cylinder';
// import { ParamDefinition as PD } from 'mol-util/param-definition'; import { ParamDefinition as PD } from 'mol-util/param-definition';
// import { ComplexRepresentation } from '../complex-representation'; import { ComplexRepresentation } from '../complex-representation';
// import { StructureRepresentation } from '../representation'; import { StructureRepresentation, StructureRepresentationProvider } from '../representation';
// import { Representation } from 'mol-repr/representation'; import { Representation, RepresentationParamsGetter } 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 { BuiltInColorThemeOptions, getBuiltInColorThemeParams } from 'mol-theme/color';
// export const CarbohydrateParams = { const CarbohydrateVisuals = {
// ...CarbohydrateSymbolParams, 'carbohydrate-symbol': (getParams: RepresentationParamsGetter<Structure, CarbohydrateSymbolParams>) => ComplexRepresentation('Carbohydrate symbol mesh', getParams, CarbohydrateSymbolVisual),
// ...CarbohydrateLinkParams, 'carbohydrate-link': (getParams: RepresentationParamsGetter<Structure, CarbohydrateLinkParams>) => ComplexRepresentation('Carbohydrate link cylinder', getParams, CarbohydrateLinkVisual),
// } }
// export function getCarbohydrateParams(ctx: ThemeRegistryContext, structure: Structure) { type CarbohydrateVisualName = keyof typeof CarbohydrateVisuals
// return CarbohydrateParams // TODO return copy const CarbohydrateVisualOptions = Object.keys(CarbohydrateVisuals).map(name => [name, name] as [CarbohydrateVisualName, string])
// }
// export type CarbohydrateProps = PD.DefaultValues<typeof CarbohydrateParams>
// export type CarbohydrateRepresentation = StructureRepresentation<CarbohydrateProps> export const CarbohydrateParams = {
...CarbohydrateSymbolParams,
...CarbohydrateLinkParams,
colorTheme: PD.Mapped('carbohydrate-symbol', BuiltInColorThemeOptions, getBuiltInColorThemeParams),
visuals: PD.MultiSelect<CarbohydrateVisualName>(['carbohydrate-symbol', 'carbohydrate-link'], CarbohydrateVisualOptions),
}
PD.getDefaultValues(CarbohydrateParams).colorTheme.name
export type CarbohydrateParams = typeof CarbohydrateParams
export function getCarbohydrateParams(ctx: ThemeRegistryContext, structure: Structure) {
return PD.clone(CarbohydrateParams)
}
// export function CarbohydrateRepresentation(defaultProps: CarbohydrateProps): CarbohydrateRepresentation { export type CarbohydrateRepresentation = StructureRepresentation<CarbohydrateParams>
// return Representation.createMulti('Carbohydrate', defaultProps, [ export function CarbohydrateRepresentation(getParams: RepresentationParamsGetter<Structure, CarbohydrateParams>): CarbohydrateRepresentation {
// ComplexRepresentation('Carbohydrate symbol mesh', defaultProps, CarbohydrateSymbolVisual), return Representation.createMulti('Carbohydrate', getParams, CarbohydrateVisuals as unknown as Representation.Def<Structure, CarbohydrateParams>)
// ComplexRepresentation('Carbohydrate link cylinder', defaultProps, CarbohydrateLinkVisual) }
// ])
// } export const CarbohydrateRepresentationProvider: StructureRepresentationProvider<CarbohydrateParams> = {
\ No newline at end of file label: 'Carbohydrate',
description: 'Displays carbohydrate symbols (3D SNFG).',
factory: CarbohydrateRepresentation,
getParams: getCarbohydrateParams,
defaultValues: PD.getDefaultValues(CarbohydrateParams)
}
\ 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