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