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

added label propertiy to representation interface

parent 9f12599e
No related branches found
No related tags found
No related merge requests found
Showing
with 40 additions and 19 deletions
...@@ -13,6 +13,7 @@ import { MarkerAction } from '../util/marker-data'; ...@@ -13,6 +13,7 @@ import { MarkerAction } from '../util/marker-data';
export interface RepresentationProps {} export interface RepresentationProps {}
export interface Representation<D, P extends RepresentationProps = {}> { export interface Representation<D, P extends RepresentationProps = {}> {
readonly label: string
readonly renderObjects: ReadonlyArray<RenderObject> readonly renderObjects: ReadonlyArray<RenderObject>
readonly props: Readonly<P> readonly props: Readonly<P>
createOrUpdate: (props?: Partial<P>, data?: D) => Task<void> createOrUpdate: (props?: Partial<P>, data?: D) => Task<void>
......
...@@ -73,6 +73,7 @@ export function ShapeRepresentation<P extends ShapeProps>(): ShapeRepresentation ...@@ -73,6 +73,7 @@ export function ShapeRepresentation<P extends ShapeProps>(): ShapeRepresentation
} }
return { return {
label: 'Shape mesh',
get renderObjects () { return renderObjects }, get renderObjects () { return renderObjects },
get props () { return _props }, get props () { return _props },
createOrUpdate, createOrUpdate,
......
...@@ -14,7 +14,7 @@ import { getQualityProps } from '../util'; ...@@ -14,7 +14,7 @@ import { getQualityProps } from '../util';
import { StructureProps, DefaultStructureProps, StructureRepresentation } from '.'; import { StructureProps, DefaultStructureProps, StructureRepresentation } from '.';
import { ComplexVisual } from './complex-visual'; import { ComplexVisual } from './complex-visual';
export function ComplexRepresentation<P extends StructureProps>(visualCtor: () => ComplexVisual<P>): StructureRepresentation<P> { export function ComplexRepresentation<P extends StructureProps>(label: string, visualCtor: () => ComplexVisual<P>): StructureRepresentation<P> {
let visual: ComplexVisual<P> | undefined let visual: ComplexVisual<P> | undefined
let _props: P let _props: P
...@@ -41,6 +41,7 @@ export function ComplexRepresentation<P extends StructureProps>(visualCtor: () = ...@@ -41,6 +41,7 @@ export function ComplexRepresentation<P extends StructureProps>(visualCtor: () =
} }
return { return {
label,
get renderObjects() { get renderObjects() {
return visual && visual.renderObject ? [ visual.renderObject ] : [] return visual && visual.renderObject ? [ visual.renderObject ] : []
}, },
......
...@@ -20,10 +20,11 @@ export type BackboneProps = typeof DefaultBackboneProps ...@@ -20,10 +20,11 @@ export type BackboneProps = typeof DefaultBackboneProps
export type BackboneRepresentation = StructureRepresentation<BackboneProps> export type BackboneRepresentation = StructureRepresentation<BackboneProps>
export function BackboneRepresentation(): BackboneRepresentation { export function BackboneRepresentation(): BackboneRepresentation {
const traceRepr = UnitsRepresentation(PolymerBackboneVisual) const traceRepr = UnitsRepresentation('Polymer backbone cylinder', PolymerBackboneVisual)
let currentProps: BackboneProps let currentProps: BackboneProps
return { return {
label: 'Backbone',
get renderObjects() { get renderObjects() {
return [ ...traceRepr.renderObjects ] return [ ...traceRepr.renderObjects ]
}, },
......
...@@ -19,7 +19,7 @@ export const DefaultBallAndStickProps = { ...@@ -19,7 +19,7 @@ export const DefaultBallAndStickProps = {
...DefaultElementSphereProps, ...DefaultElementSphereProps,
...DefaultIntraUnitLinkProps, ...DefaultIntraUnitLinkProps,
sizeTheme: { name: 'uniform', value: 0.25 } as SizeThemeProps, sizeTheme: { name: 'uniform', value: 0.2 } as SizeThemeProps,
unitKinds: [ Unit.Kind.Atomic ] as Unit.Kind[] unitKinds: [ Unit.Kind.Atomic ] as Unit.Kind[]
} }
export type BallAndStickProps = typeof DefaultBallAndStickProps export type BallAndStickProps = typeof DefaultBallAndStickProps
...@@ -27,12 +27,13 @@ export type BallAndStickProps = typeof DefaultBallAndStickProps ...@@ -27,12 +27,13 @@ export type BallAndStickProps = typeof DefaultBallAndStickProps
export type BallAndStickRepresentation = StructureRepresentation<BallAndStickProps> export type BallAndStickRepresentation = StructureRepresentation<BallAndStickProps>
export function BallAndStickRepresentation(): BallAndStickRepresentation { export function BallAndStickRepresentation(): BallAndStickRepresentation {
const elmementRepr = UnitsRepresentation(ElementSphereVisual) const elmementRepr = UnitsRepresentation('Element sphere mesh', ElementSphereVisual)
const intraLinkRepr = UnitsRepresentation(IntraUnitLinkVisual) const intraLinkRepr = UnitsRepresentation('Intra-unit link cylinder', IntraUnitLinkVisual)
const interLinkRepr = ComplexRepresentation(InterUnitLinkVisual) const interLinkRepr = ComplexRepresentation('Inter-unit link cylinder', InterUnitLinkVisual)
let currentProps: BallAndStickProps let currentProps: BallAndStickProps
return { return {
label: 'Ball & Stick',
get renderObjects() { get renderObjects() {
return [ ...elmementRepr.renderObjects, ...intraLinkRepr.renderObjects, ...interLinkRepr.renderObjects ] return [ ...elmementRepr.renderObjects, ...intraLinkRepr.renderObjects, ...interLinkRepr.renderObjects ]
}, },
......
...@@ -12,21 +12,25 @@ import { Loci, isEmptyLoci } from 'mol-model/loci'; ...@@ -12,21 +12,25 @@ import { Loci, isEmptyLoci } from 'mol-model/loci';
import { MarkerAction } from '../../../util/marker-data'; import { MarkerAction } from '../../../util/marker-data';
import { CarbohydrateSymbolVisual, DefaultCarbohydrateSymbolProps } from '../visual/carbohydrate-symbol-mesh'; import { CarbohydrateSymbolVisual, DefaultCarbohydrateSymbolProps } from '../visual/carbohydrate-symbol-mesh';
import { CarbohydrateLinkVisual, DefaultCarbohydrateLinkProps } from '../visual/carbohydrate-link-cylinder'; import { CarbohydrateLinkVisual, DefaultCarbohydrateLinkProps } from '../visual/carbohydrate-link-cylinder';
import { SizeThemeProps } from 'mol-view/theme/size';
export const DefaultCartoonProps = { export const DefaultCartoonProps = {
...DefaultCarbohydrateSymbolProps, ...DefaultCarbohydrateSymbolProps,
...DefaultCarbohydrateLinkProps ...DefaultCarbohydrateLinkProps,
sizeTheme: { name: 'uniform', value: 1, factor: 1 } as SizeThemeProps,
} }
export type CarbohydrateProps = typeof DefaultCartoonProps export type CarbohydrateProps = typeof DefaultCartoonProps
export type CarbohydrateRepresentation = StructureRepresentation<CarbohydrateProps> export type CarbohydrateRepresentation = StructureRepresentation<CarbohydrateProps>
export function CarbohydrateRepresentation(): CarbohydrateRepresentation { export function CarbohydrateRepresentation(): CarbohydrateRepresentation {
const carbohydrateSymbolRepr = ComplexRepresentation(CarbohydrateSymbolVisual) const carbohydrateSymbolRepr = ComplexRepresentation('Carbohydrate symbol mesh', CarbohydrateSymbolVisual)
const carbohydrateLinkRepr = ComplexRepresentation(CarbohydrateLinkVisual) const carbohydrateLinkRepr = ComplexRepresentation('Carbohydrate link cylinder', CarbohydrateLinkVisual)
let currentProps: CarbohydrateProps let currentProps: CarbohydrateProps
return { return {
label: 'Carbohydrate',
get renderObjects() { get renderObjects() {
return [ ...carbohydrateSymbolRepr.renderObjects, ...carbohydrateLinkRepr.renderObjects ] return [ ...carbohydrateSymbolRepr.renderObjects, ...carbohydrateLinkRepr.renderObjects ]
}, },
......
...@@ -13,26 +13,30 @@ import { MarkerAction } from '../../../util/marker-data'; ...@@ -13,26 +13,30 @@ import { MarkerAction } from '../../../util/marker-data';
import { PolymerTraceVisual, DefaultPolymerTraceProps } from '../visual/polymer-trace-mesh'; import { PolymerTraceVisual, DefaultPolymerTraceProps } from '../visual/polymer-trace-mesh';
import { PolymerGapVisual, DefaultPolymerGapProps } from '../visual/polymer-gap-cylinder'; import { PolymerGapVisual, DefaultPolymerGapProps } from '../visual/polymer-gap-cylinder';
import { NucleotideBlockVisual, DefaultNucleotideBlockProps } from '../visual/nucleotide-block-mesh'; import { NucleotideBlockVisual, DefaultNucleotideBlockProps } from '../visual/nucleotide-block-mesh';
import { /* PolymerDirectionVisual, */ DefaultPolymerDirectionProps } from '../visual/polymer-direction-wedge'; import { SizeThemeProps } from 'mol-view/theme/size';
// import { PolymerDirectionVisual, DefaultPolymerDirectionProps } from '../visual/polymer-direction-wedge';
export const DefaultCartoonProps = { export const DefaultCartoonProps = {
...DefaultPolymerTraceProps, ...DefaultPolymerTraceProps,
...DefaultPolymerGapProps, ...DefaultPolymerGapProps,
...DefaultNucleotideBlockProps, ...DefaultNucleotideBlockProps,
...DefaultPolymerDirectionProps // ...DefaultPolymerDirectionProps,
sizeTheme: { name: 'uniform', value: 0.2 } as SizeThemeProps,
} }
export type CartoonProps = typeof DefaultCartoonProps export type CartoonProps = typeof DefaultCartoonProps
export type CartoonRepresentation = StructureRepresentation<CartoonProps> export type CartoonRepresentation = StructureRepresentation<CartoonProps>
export function CartoonRepresentation(): CartoonRepresentation { export function CartoonRepresentation(): CartoonRepresentation {
const traceRepr = UnitsRepresentation(PolymerTraceVisual) const traceRepr = UnitsRepresentation('Polymer trace mesh', PolymerTraceVisual)
const gapRepr = UnitsRepresentation(PolymerGapVisual) const gapRepr = UnitsRepresentation('Polymer gap cylinder', PolymerGapVisual)
const blockRepr = UnitsRepresentation(NucleotideBlockVisual) const blockRepr = UnitsRepresentation('Nucleotide block mesh', NucleotideBlockVisual)
// const directionRepr = UnitsRepresentation(PolymerDirectionVisual) // const directionRepr = UnitsRepresentation('Polymer direction wedge', PolymerDirectionVisual)
let currentProps: CartoonProps let currentProps: CartoonProps
return { return {
label: 'Cartoon',
get renderObjects() { get renderObjects() {
return [ ...traceRepr.renderObjects, ...gapRepr.renderObjects, return [ ...traceRepr.renderObjects, ...gapRepr.renderObjects,
...blockRepr.renderObjects // , ...directionRepr.renderObjects ...blockRepr.renderObjects // , ...directionRepr.renderObjects
......
...@@ -22,10 +22,11 @@ export type DistanceRestraintProps = typeof DefaultDistanceRestraintProps ...@@ -22,10 +22,11 @@ export type DistanceRestraintProps = typeof DefaultDistanceRestraintProps
export type DistanceRestraintRepresentation = StructureRepresentation<DistanceRestraintProps> export type DistanceRestraintRepresentation = StructureRepresentation<DistanceRestraintProps>
export function DistanceRestraintRepresentation(): DistanceRestraintRepresentation { export function DistanceRestraintRepresentation(): DistanceRestraintRepresentation {
const crossLinkRepr = ComplexRepresentation(CrossLinkRestraintVisual) const crossLinkRepr = ComplexRepresentation('Cross-link restraint', CrossLinkRestraintVisual)
let currentProps: DistanceRestraintProps let currentProps: DistanceRestraintProps
return { return {
label: 'Distance restraint',
get renderObjects() { get renderObjects() {
return [ ...crossLinkRepr.renderObjects ] return [ ...crossLinkRepr.renderObjects ]
}, },
......
...@@ -7,14 +7,17 @@ ...@@ -7,14 +7,17 @@
import { UnitsRepresentation } from '..'; import { UnitsRepresentation } from '..';
import { ElementPointVisual, DefaultElementPointProps } from '../visual/element-point'; import { ElementPointVisual, DefaultElementPointProps } from '../visual/element-point';
import { StructureRepresentation } from '../units-representation'; import { StructureRepresentation } from '../units-representation';
import { SizeThemeProps } from 'mol-view/theme/size';
export const DefaultPointProps = { export const DefaultPointProps = {
...DefaultElementPointProps, ...DefaultElementPointProps,
sizeTheme: { name: 'uniform', value: 0.2 } as SizeThemeProps,
} }
export type PointProps = typeof DefaultPointProps export type PointProps = typeof DefaultPointProps
export type PointRepresentation = StructureRepresentation<PointProps> export type PointRepresentation = StructureRepresentation<PointProps>
export function PointRepresentation(): PointRepresentation { export function PointRepresentation(): PointRepresentation {
return UnitsRepresentation(ElementPointVisual) return UnitsRepresentation('Point', ElementPointVisual)
} }
\ No newline at end of file
...@@ -16,5 +16,5 @@ export type SpacefillProps = typeof DefaultSpacefillProps ...@@ -16,5 +16,5 @@ export type SpacefillProps = typeof DefaultSpacefillProps
export type SpacefillRepresentation = StructureRepresentation<SpacefillProps> export type SpacefillRepresentation = StructureRepresentation<SpacefillProps>
export function SpacefillRepresentation(): SpacefillRepresentation { export function SpacefillRepresentation(): SpacefillRepresentation {
return UnitsRepresentation(ElementSphereVisual) return UnitsRepresentation('Spacefill', ElementSphereVisual)
} }
\ No newline at end of file
...@@ -75,6 +75,7 @@ export function ElementPointVisual(): UnitsVisual<ElementPointProps> { ...@@ -75,6 +75,7 @@ export function ElementPointVisual(): UnitsVisual<ElementPointProps> {
vertices = await createElementPointVertices(ctx, unit, vertices) vertices = await createElementPointVertices(ctx, unit, vertices)
renderObject = await createUnitsPointRenderObject(ctx, group, vertices, locationIt, currentProps) renderObject = await createUnitsPointRenderObject(ctx, group, vertices, locationIt, currentProps)
console.log(renderObject)
} else if (renderObject) { } else if (renderObject) {
if (group) currentGroup = group if (group) currentGroup = group
......
...@@ -51,6 +51,7 @@ async function createInterUnitLinkCylinderMesh(ctx: RuntimeContext, structure: S ...@@ -51,6 +51,7 @@ async function createInterUnitLinkCylinderMesh(ctx: RuntimeContext, structure: S
export const DefaultInterUnitLinkProps = { export const DefaultInterUnitLinkProps = {
...DefaultComplexMeshProps, ...DefaultComplexMeshProps,
...DefaultLinkCylinderProps, ...DefaultLinkCylinderProps,
sizeTheme: { name: 'physical', factor: 0.3 } as SizeThemeProps, sizeTheme: { name: 'physical', factor: 0.3 } as SizeThemeProps,
} }
export type InterUnitLinkProps = typeof DefaultInterUnitLinkProps export type InterUnitLinkProps = typeof DefaultInterUnitLinkProps
......
...@@ -65,6 +65,7 @@ async function createIntraUnitLinkCylinderMesh(ctx: RuntimeContext, unit: Unit, ...@@ -65,6 +65,7 @@ async function createIntraUnitLinkCylinderMesh(ctx: RuntimeContext, unit: Unit,
export const DefaultIntraUnitLinkProps = { export const DefaultIntraUnitLinkProps = {
...DefaultUnitsMeshProps, ...DefaultUnitsMeshProps,
...DefaultLinkCylinderProps, ...DefaultLinkCylinderProps,
sizeTheme: { name: 'physical', factor: 0.3 } as SizeThemeProps, sizeTheme: { name: 'physical', factor: 0.3 } as SizeThemeProps,
} }
export type IntraUnitLinkProps = typeof DefaultIntraUnitLinkProps export type IntraUnitLinkProps = typeof DefaultIntraUnitLinkProps
......
...@@ -14,7 +14,7 @@ export const DefaultBaseProps = { ...@@ -14,7 +14,7 @@ export const DefaultBaseProps = {
alpha: 1, alpha: 1,
visible: true, visible: true,
depthMask: true, depthMask: true,
useFog: true, useFog: false,
quality: 'auto' as VisualQuality quality: 'auto' as VisualQuality
} }
export type BaseProps = typeof DefaultBaseProps export type BaseProps = typeof DefaultBaseProps
......
...@@ -42,6 +42,7 @@ export function VolumeRepresentation<P extends VolumeProps>(visualCtor: (volumeD ...@@ -42,6 +42,7 @@ export function VolumeRepresentation<P extends VolumeProps>(visualCtor: (volumeD
} }
return { return {
label: 'Volume mesh',
get renderObjects () { return renderObjects }, get renderObjects () { return renderObjects },
get props () { return _props }, get props () { return _props },
createOrUpdate, createOrUpdate,
......
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