registry.ts 1.3 KB

12345678910111213141516171819202122232425262728
  1. /**
  2. * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  5. */
  6. import { RepresentationProvider, RepresentationRegistry, Representation } from '../representation';
  7. import { VolumeData } from 'mol-model/volume';
  8. import { IsosurfaceRepresentationProvider } from './isosurface-mesh';
  9. import { DirectVolumeRepresentationProvider } from './direct-volume';
  10. export class VolumeRepresentationRegistry extends RepresentationRegistry<VolumeData, Representation.State> {
  11. constructor() {
  12. super()
  13. Object.keys(BuiltInVolumeRepresentations).forEach(name => {
  14. const p = (BuiltInVolumeRepresentations as { [k: string]: RepresentationProvider<VolumeData, any, Representation.State> })[name]
  15. this.add(name, p)
  16. })
  17. }
  18. }
  19. export const BuiltInVolumeRepresentations = {
  20. 'isosurface': IsosurfaceRepresentationProvider,
  21. 'direct-volume': DirectVolumeRepresentationProvider,
  22. }
  23. export type BuiltInVolumeRepresentationsName = keyof typeof BuiltInVolumeRepresentations
  24. export const BuiltInVolumeRepresentationsNames = Object.keys(BuiltInVolumeRepresentations)
  25. export const BuiltInVolumeRepresentationsOptions = BuiltInVolumeRepresentationsNames.map(n => [n, n] as [BuiltInVolumeRepresentationsName, string])