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
import { CartoonRepresentationProvider } from './representation/cartoon';
import { BallAndStickRepresentationProvider } from './representation/ball-and-stick';
import { MolecularSurfaceRepresentationProvider } from './representation/molecular-surface';
import { CarbohydrateRepresentationProvider } from './representation/carbohydrate';
export class StructureRepresentationRegistry extends RepresentationRegistry<Structure> {
constructor() {
......@@ -24,6 +25,7 @@ export const BuiltInStructureRepresentations = {
'cartoon': CartoonRepresentationProvider,
'ball-and-stick': BallAndStickRepresentationProvider,
'molecular-surface': MolecularSurfaceRepresentationProvider,
'carbohydrate': CarbohydrateRepresentationProvider,
}
export type BuiltInStructureRepresentationsName = keyof typeof BuiltInStructureRepresentations
export const BuiltInStructureRepresentationsNames = Object.keys(BuiltInStructureRepresentations)
......
// /**
// * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
// *
// * @author Alexander Rose <alexander.rose@weirdbyte.de>
// */
/**
* Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
// import { CarbohydrateSymbolVisual, CarbohydrateSymbolParams } from '../visual/carbohydrate-symbol-mesh';
// import { CarbohydrateLinkVisual, CarbohydrateLinkParams } from '../visual/carbohydrate-link-cylinder';
// import { ParamDefinition as PD } from 'mol-util/param-definition';
// import { ComplexRepresentation } from '../complex-representation';
// import { StructureRepresentation } from '../representation';
// import { Representation } from 'mol-repr/representation';
// import { ThemeRegistryContext } from 'mol-theme/theme';
// import { Structure } from 'mol-model/structure';
import { CarbohydrateSymbolVisual, CarbohydrateSymbolParams } from '../visual/carbohydrate-symbol-mesh';
import { CarbohydrateLinkVisual, CarbohydrateLinkParams } from '../visual/carbohydrate-link-cylinder';
import { ParamDefinition as PD } from 'mol-util/param-definition';
import { ComplexRepresentation } from '../complex-representation';
import { StructureRepresentation, StructureRepresentationProvider } from '../representation';
import { Representation, RepresentationParamsGetter } from 'mol-repr/representation';
import { ThemeRegistryContext } from 'mol-theme/theme';
import { Structure } from 'mol-model/structure';
import { BuiltInColorThemeOptions, getBuiltInColorThemeParams } from 'mol-theme/color';
// export const CarbohydrateParams = {
// ...CarbohydrateSymbolParams,
// ...CarbohydrateLinkParams,
// }
// export function getCarbohydrateParams(ctx: ThemeRegistryContext, structure: Structure) {
// return CarbohydrateParams // TODO return copy
// }
// export type CarbohydrateProps = PD.DefaultValues<typeof CarbohydrateParams>
const CarbohydrateVisuals = {
'carbohydrate-symbol': (getParams: RepresentationParamsGetter<Structure, CarbohydrateSymbolParams>) => ComplexRepresentation('Carbohydrate symbol mesh', getParams, CarbohydrateSymbolVisual),
'carbohydrate-link': (getParams: RepresentationParamsGetter<Structure, CarbohydrateLinkParams>) => ComplexRepresentation('Carbohydrate link cylinder', getParams, CarbohydrateLinkVisual),
}
type CarbohydrateVisualName = keyof typeof CarbohydrateVisuals
const CarbohydrateVisualOptions = Object.keys(CarbohydrateVisuals).map(name => [name, name] as [CarbohydrateVisualName, string])
// 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 {
// return Representation.createMulti('Carbohydrate', defaultProps, [
// ComplexRepresentation('Carbohydrate symbol mesh', defaultProps, CarbohydrateSymbolVisual),
// ComplexRepresentation('Carbohydrate link cylinder', defaultProps, CarbohydrateLinkVisual)
// ])
// }
\ No newline at end of file
export type CarbohydrateRepresentation = StructureRepresentation<CarbohydrateParams>
export function CarbohydrateRepresentation(getParams: RepresentationParamsGetter<Structure, CarbohydrateParams>): CarbohydrateRepresentation {
return Representation.createMulti('Carbohydrate', getParams, CarbohydrateVisuals as unknown as Representation.Def<Structure, CarbohydrateParams>)
}
export const CarbohydrateRepresentationProvider: StructureRepresentationProvider<CarbohydrateParams> = {
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.
Finish editing this message first!
Please register or to comment