diff --git a/src/mol-app/ui/transform/backbone.tsx b/src/mol-app/ui/transform/backbone.tsx index 37c8e8607508002b9bc38c0bd71b785eed3d39a5..6af3137f9a65dcd3c59f53966a6170de3bea9728 100644 --- a/src/mol-app/ui/transform/backbone.tsx +++ b/src/mol-app/ui/transform/backbone.tsx @@ -15,7 +15,8 @@ import { Toggle } from '../controls/common'; import { BackboneEntity } from 'mol-view/state/entity'; import { BackboneUpdate } from 'mol-view/state/transform' import { StateContext } from 'mol-view/state/context'; -import { ColorThemeProps, SizeThemeProps, ColorThemeNames, ColorThemeName } from 'mol-geo/theme'; +import { ColorThemeProps, ColorThemeNames, ColorThemeName } from 'mol-view/theme/color'; +import { SizeThemeProps } from 'mol-view/theme/size'; import { Color, ColorNames } from 'mol-util/color'; import { Slider } from '../controls/slider'; import { VisualQuality } from 'mol-geo/representation/util'; diff --git a/src/mol-app/ui/transform/ball-and-stick.tsx b/src/mol-app/ui/transform/ball-and-stick.tsx index d75ed5dab6c51d315c87d8f08930c8bc4f620e55..382758903a956f27055cabc6d0537fa00c98ad3c 100644 --- a/src/mol-app/ui/transform/ball-and-stick.tsx +++ b/src/mol-app/ui/transform/ball-and-stick.tsx @@ -15,7 +15,8 @@ import { Toggle } from '../controls/common'; import { DistanceRestraintEntity } from 'mol-view/state/entity'; import { DistanceRestraintUpdate } from 'mol-view/state/transform' import { StateContext } from 'mol-view/state/context'; -import { ColorThemeProps, SizeThemeProps, ColorThemeName, ColorThemeNames } from 'mol-geo/theme'; +import { ColorThemeProps, ColorThemeNames, ColorThemeName } from 'mol-view/theme/color'; +import { SizeThemeProps } from 'mol-view/theme/size'; import { Color, ColorNames } from 'mol-util/color'; import { Slider } from '../controls/slider'; import { VisualQuality } from 'mol-geo/representation/util'; diff --git a/src/mol-app/ui/transform/carbohydrate.tsx b/src/mol-app/ui/transform/carbohydrate.tsx index 03906a2048299a2eb0612a51c6c2fb847799bc24..d672d4d81b2bf9037ef18f50dec094b3e7c06c29 100644 --- a/src/mol-app/ui/transform/carbohydrate.tsx +++ b/src/mol-app/ui/transform/carbohydrate.tsx @@ -15,7 +15,8 @@ import { Toggle } from '../controls/common'; import { CarbohydrateEntity } from 'mol-view/state/entity'; import { CarbohydrateUpdate } from 'mol-view/state/transform' import { StateContext } from 'mol-view/state/context'; -import { ColorThemeProps, SizeThemeProps, ColorThemeName, ColorThemeNames } from 'mol-geo/theme'; +import { ColorThemeProps, ColorThemeNames, ColorThemeName } from 'mol-view/theme/color'; +import { SizeThemeProps } from 'mol-view/theme/size'; import { Color, ColorNames } from 'mol-util/color'; import { Slider } from '../controls/slider'; import { VisualQuality } from 'mol-geo/representation/util'; diff --git a/src/mol-app/ui/transform/cartoon.tsx b/src/mol-app/ui/transform/cartoon.tsx index 4b6d7da140d54ee61d99868fdc4b04a6d71b937b..32dfeba9acdab90a55d8b7a49aa59afc4cfbe63b 100644 --- a/src/mol-app/ui/transform/cartoon.tsx +++ b/src/mol-app/ui/transform/cartoon.tsx @@ -15,7 +15,8 @@ import { Toggle } from '../controls/common'; import { CartoonEntity } from 'mol-view/state/entity'; import { CartoonUpdate } from 'mol-view/state/transform' import { StateContext } from 'mol-view/state/context'; -import { ColorThemeProps, SizeThemeProps, ColorThemeName, ColorThemeNames } from 'mol-geo/theme'; +import { ColorThemeProps, ColorThemeNames, ColorThemeName } from 'mol-view/theme/color'; +import { SizeThemeProps } from 'mol-view/theme/size'; import { Color, ColorNames } from 'mol-util/color'; import { Slider } from '../controls/slider'; import { VisualQuality } from 'mol-geo/representation/util'; diff --git a/src/mol-app/ui/transform/distance-restraint.tsx b/src/mol-app/ui/transform/distance-restraint.tsx index d349db4dc18f8d59d73cbfe8bb2aefd4238cf53c..374cc11b02033fd1ca325f828143ce4a7ebf7c4f 100644 --- a/src/mol-app/ui/transform/distance-restraint.tsx +++ b/src/mol-app/ui/transform/distance-restraint.tsx @@ -15,7 +15,8 @@ import { Toggle } from '../controls/common'; import { DistanceRestraintEntity } from 'mol-view/state/entity'; import { DistanceRestraintUpdate } from 'mol-view/state/transform' import { StateContext } from 'mol-view/state/context'; -import { ColorThemeProps, SizeThemeProps, ColorThemeName, ColorThemeNames } from 'mol-geo/theme'; +import { ColorThemeProps, ColorThemeNames, ColorThemeName } from 'mol-view/theme/color'; +import { SizeThemeProps } from 'mol-view/theme/size'; import { Color, ColorNames } from 'mol-util/color'; import { Slider } from '../controls/slider'; import { VisualQuality } from 'mol-geo/representation/util'; diff --git a/src/mol-app/ui/transform/spacefill.tsx b/src/mol-app/ui/transform/spacefill.tsx index b1df358985709a2cc34e784cf71004b3e047380c..d4a4d9e57cfe67727845a028686b3ab97f9934e8 100644 --- a/src/mol-app/ui/transform/spacefill.tsx +++ b/src/mol-app/ui/transform/spacefill.tsx @@ -15,7 +15,8 @@ import { Toggle } from '../controls/common'; import { SpacefillEntity } from 'mol-view/state/entity'; import { SpacefillUpdate } from 'mol-view/state/transform' import { StateContext } from 'mol-view/state/context'; -import { ColorThemeProps, SizeThemeProps, ColorThemeName, ColorThemeNames } from 'mol-geo/theme'; +import { ColorThemeProps, ColorThemeNames, ColorThemeName } from 'mol-view/theme/color'; +import { SizeThemeProps } from 'mol-view/theme/size'; import { Color, ColorNames } from 'mol-util/color'; import { Slider } from '../controls/slider'; import { VisualQuality } from 'mol-geo/representation/util'; diff --git a/src/mol-geo/representation/structure/index.ts b/src/mol-geo/representation/structure/index.ts index bf782aab901b5285f761840255636b19e3cc8a32..4433e1ebf28a9343e113b64c4fe5063819782fbc 100644 --- a/src/mol-geo/representation/structure/index.ts +++ b/src/mol-geo/representation/structure/index.ts @@ -6,8 +6,9 @@ */ import { Structure } from 'mol-model/structure'; +import { ColorThemeProps } from 'mol-view/theme/color'; +import { SizeThemeProps } from 'mol-view/theme/size'; import { Representation, RepresentationProps } from '..'; -import { ColorThemeProps, SizeThemeProps } from '../../theme'; import { DefaultBaseProps, DefaultMeshProps } from '../util'; export interface StructureRepresentation<P extends RepresentationProps = {}> extends Representation<Structure, P> { } diff --git a/src/mol-geo/representation/structure/representation/ball-and-stick.ts b/src/mol-geo/representation/structure/representation/ball-and-stick.ts index 0b61537b1d7b2b44254a1204cee667e31df358a6..d26ab096839de45dba420f8cd18c14da374f3c1f 100644 --- a/src/mol-geo/representation/structure/representation/ball-and-stick.ts +++ b/src/mol-geo/representation/structure/representation/ball-and-stick.ts @@ -12,8 +12,8 @@ import { Structure, Unit } from 'mol-model/structure'; import { Task } from 'mol-task'; import { Loci, isEmptyLoci } from 'mol-model/loci'; import { MarkerAction } from '../../../util/marker-data'; -import { SizeThemeProps } from '../../../theme'; import { InterUnitLinkVisual } from '../visual/inter-unit-link-cylinder'; +import { SizeThemeProps } from 'mol-view/theme/size'; export const DefaultBallAndStickProps = { ...DefaultElementSphereProps, diff --git a/src/mol-geo/representation/structure/representation/distance-restraint.ts b/src/mol-geo/representation/structure/representation/distance-restraint.ts index 31c8d5d4e5c9703bcc1068bdddd477546c825dab..bf16518eb73e61c16ad4a8b1395a02eca2c4ac38 100644 --- a/src/mol-geo/representation/structure/representation/distance-restraint.ts +++ b/src/mol-geo/representation/structure/representation/distance-restraint.ts @@ -10,8 +10,8 @@ import { Structure } from 'mol-model/structure'; import { Task } from 'mol-task'; import { Loci } from 'mol-model/loci'; import { MarkerAction } from '../../../util/marker-data'; -import { SizeThemeProps } from '../../../theme'; import { CrossLinkRestraintVisual, DefaultCrossLinkRestraintProps } from '../visual/cross-link-restraint-cylinder'; +import { SizeThemeProps } from 'mol-view/theme/size'; export const DefaultDistanceRestraintProps = { ...DefaultCrossLinkRestraintProps, diff --git a/src/mol-geo/representation/structure/visual/carbohydrate-link-cylinder.ts b/src/mol-geo/representation/structure/visual/carbohydrate-link-cylinder.ts index dab6656225a1d1a2d1c444ad436c6f42353bd477..547763c768ab7f7df675527202febb42fb2b31fb 100644 --- a/src/mol-geo/representation/structure/visual/carbohydrate-link-cylinder.ts +++ b/src/mol-geo/representation/structure/visual/carbohydrate-link-cylinder.ts @@ -10,13 +10,13 @@ import { RuntimeContext } from 'mol-task' import { Mesh } from '../../../shape/mesh'; import { PickingId } from '../../../util/picking'; import { Loci, EmptyLoci } from 'mol-model/loci'; -import { SizeThemeProps } from '../../../theme'; import { DefaultMeshProps } from '../../util'; import { Vec3 } from 'mol-math/linear-algebra'; import { LocationIterator } from './util/location-iterator'; import { createLinkCylinderMesh, DefaultLinkCylinderProps, LinkCylinderProps } from './util/link'; import { OrderedSet, Interval } from 'mol-data/int'; import { ComplexMeshVisual } from '../complex-visual'; +import { SizeThemeProps } from 'mol-view/theme/size'; // TODO create seperate visual // for (let i = 0, il = carbohydrates.terminalLinks.length; i < il; ++i) { diff --git a/src/mol-geo/representation/structure/visual/carbohydrate-symbol-mesh.ts b/src/mol-geo/representation/structure/visual/carbohydrate-symbol-mesh.ts index 7eba343552ec54a92e26db174a856c01fc8cc66c..f4336e8c6dbc3272c5a8213e9e47ff16f187e63e 100644 --- a/src/mol-geo/representation/structure/visual/carbohydrate-symbol-mesh.ts +++ b/src/mol-geo/representation/structure/visual/carbohydrate-symbol-mesh.ts @@ -10,7 +10,6 @@ import { RuntimeContext } from 'mol-task' import { Mesh } from '../../../shape/mesh'; import { PickingId } from '../../../util/picking'; import { Loci, EmptyLoci } from 'mol-model/loci'; -import { SizeThemeProps } from '../../../theme'; import { DefaultMeshProps } from '../../util'; import { MeshBuilder } from '../../../shape/mesh-builder'; import { Vec3, Mat4 } from 'mol-math/linear-algebra'; @@ -18,6 +17,7 @@ import { getSaccharideShape, SaccharideShapes } from 'mol-model/structure/struct import { LocationIterator } from './util/location-iterator'; import { OrderedSet, Interval } from 'mol-data/int'; import { ComplexMeshVisual } from '../complex-visual'; +import { SizeThemeProps } from 'mol-view/theme/size'; const t = Mat4.identity() const sVec = Vec3.zero() diff --git a/src/mol-geo/representation/structure/visual/cross-link-restraint-cylinder.ts b/src/mol-geo/representation/structure/visual/cross-link-restraint-cylinder.ts index f93a8bbfe4193ad3b96228499074da2697a8e6bc..bfa5997a355f02e29c9b5650ff2ad551261a8e1b 100644 --- a/src/mol-geo/representation/structure/visual/cross-link-restraint-cylinder.ts +++ b/src/mol-geo/representation/structure/visual/cross-link-restraint-cylinder.ts @@ -12,10 +12,10 @@ import { Mesh } from '../../../shape/mesh'; import { PickingId } from '../../../util/picking'; import { Vec3 } from 'mol-math/linear-algebra'; import { Loci, EmptyLoci } from 'mol-model/loci'; -import { SizeThemeProps } from '../../../theme'; import { ComplexMeshVisual } from '../complex-visual'; import { LocationIterator } from './util/location-iterator'; import { Interval } from 'mol-data/int'; +import { SizeThemeProps } from 'mol-view/theme/size'; async function createCrossLinkRestraintCylinderMesh(ctx: RuntimeContext, structure: Structure, props: LinkCylinderProps, mesh?: Mesh) { diff --git a/src/mol-geo/representation/structure/visual/element-point.ts b/src/mol-geo/representation/structure/visual/element-point.ts index 01764652eb68e995c4201f14c54d8e1137831548..57306c4b9765092b471cead32cb6342c20023c26 100644 --- a/src/mol-geo/representation/structure/visual/element-point.ts +++ b/src/mol-geo/representation/structure/visual/element-point.ts @@ -11,7 +11,6 @@ import { Unit } from 'mol-model/structure'; import { RuntimeContext } from 'mol-task' import { UnitsVisual, DefaultStructureProps } from '..'; -import { SizeThemeProps } from '../../../theme'; import { getElementLoci } from './util/element'; import { createTransforms, createColors, createSizes } from './util/common'; import { deepEqual, defaults } from 'mol-util'; @@ -23,6 +22,7 @@ import { MarkerAction, createMarkers } from '../../../util/marker-data'; import { Vec3 } from 'mol-math/linear-algebra'; import { fillSerial } from 'mol-util/array'; import { StructureElementIterator } from './util/location-iterator'; +import { SizeThemeProps } from 'mol-view/theme/size'; export const DefaultPointProps = { ...DefaultStructureProps, diff --git a/src/mol-geo/representation/structure/visual/inter-unit-link-cylinder.ts b/src/mol-geo/representation/structure/visual/inter-unit-link-cylinder.ts index 2ace15d06c553ae0a0dd62fbe4e7d6ad20ffb068..ca09e68c39c8080888115cfa0a7320f272aee5dc 100644 --- a/src/mol-geo/representation/structure/visual/inter-unit-link-cylinder.ts +++ b/src/mol-geo/representation/structure/visual/inter-unit-link-cylinder.ts @@ -12,10 +12,10 @@ import { Mesh } from '../../../shape/mesh'; import { PickingId } from '../../../util/picking'; import { Vec3 } from 'mol-math/linear-algebra'; import { Loci, EmptyLoci } from 'mol-model/loci'; -import { SizeThemeProps } from '../../../theme'; import { LinkIterator } from './util/location-iterator'; import { ComplexMeshVisual } from '../complex-visual'; import { Interval } from 'mol-data/int'; +import { SizeThemeProps } from 'mol-view/theme/size'; async function createInterUnitLinkCylinderMesh(ctx: RuntimeContext, structure: Structure, props: LinkCylinderProps, mesh?: Mesh) { const links = structure.links diff --git a/src/mol-geo/representation/structure/visual/intra-unit-link-cylinder.ts b/src/mol-geo/representation/structure/visual/intra-unit-link-cylinder.ts index ec5c170e551fa3da5f4d359ada17e3395475ee50..e9a1ccae09784bf36f753562813ee3875b38e2fa 100644 --- a/src/mol-geo/representation/structure/visual/intra-unit-link-cylinder.ts +++ b/src/mol-geo/representation/structure/visual/intra-unit-link-cylinder.ts @@ -13,10 +13,10 @@ import { Mesh } from '../../../shape/mesh'; import { PickingId } from '../../../util/picking'; import { Vec3 } from 'mol-math/linear-algebra'; import { Loci, EmptyLoci } from 'mol-model/loci'; -import { SizeThemeProps } from '../../../theme'; import { LinkIterator } from './util/location-iterator'; import { UnitsMeshVisual, DefaultUnitsMeshProps } from '../units-visual'; import { Interval } from 'mol-data/int'; +import { SizeThemeProps } from 'mol-view/theme/size'; async function createIntraUnitLinkCylinderMesh(ctx: RuntimeContext, unit: Unit, props: LinkCylinderProps, mesh?: Mesh) { if (!Unit.isAtomic(unit)) return Mesh.createEmpty(mesh) diff --git a/src/mol-geo/representation/structure/visual/util/common.ts b/src/mol-geo/representation/structure/visual/util/common.ts index 3a578e16ec3720680d21ebefe62e1d4f3ac1e05f..fb7f11bf733b6055d8968d4c2dd7b5231608810a 100644 --- a/src/mol-geo/representation/structure/visual/util/common.ts +++ b/src/mol-geo/representation/structure/visual/util/common.ts @@ -10,8 +10,6 @@ import { Mat4 } from 'mol-math/linear-algebra' import { createUniformColor, ColorData, createElementColor, createElementInstanceColor, createInstanceColor } from '../../../../util/color-data'; import { createUniformSize, SizeData, createElementSize, createElementInstanceSize, createInstanceSize } from '../../../../util/size-data'; -import { ColorThemeProps, SizeThemeProps } from '../../../../theme'; -import { ColorTheme } from '../../../../theme/structure/color'; import { ValueCell } from 'mol-util'; import { LocationIterator } from './location-iterator'; import { Mesh } from '../../../../shape/mesh'; @@ -21,7 +19,8 @@ import { MeshProps, createMeshValues, createRenderableState } from '../../../uti import { StructureProps } from '../..'; import { createMarkers } from '../../../../util/marker-data'; import { createMeshRenderObject } from 'mol-gl/render-object'; -import { SizeTheme } from '../../../../theme/structure/size'; +import { ColorThemeProps, ColorTheme } from 'mol-view/theme/color'; +import { SizeThemeProps, SizeTheme } from 'mol-view/theme/size'; export function createTransforms({ units }: Unit.SymmetryGroup, transforms?: ValueCell<Float32Array>) { const unitCount = units.length diff --git a/src/mol-geo/representation/structure/visual/util/element.ts b/src/mol-geo/representation/structure/visual/util/element.ts index 4e03cc13ae073ae039cc1a6b3833741df6c1e02d..89934754869f743e1321cadd11697e14e4296517 100644 --- a/src/mol-geo/representation/structure/visual/util/element.ts +++ b/src/mol-geo/representation/structure/visual/util/element.ts @@ -13,8 +13,7 @@ import { MeshBuilder } from '../../../../shape/mesh-builder'; import { Loci, EmptyLoci } from 'mol-model/loci'; import { Interval, OrderedSet } from 'mol-data/int'; import { PickingId } from '../../../../util/picking'; -import { SizeThemeProps } from '../../../../theme'; -import { SizeTheme } from '../../../../theme/structure/size'; +import { SizeTheme, SizeThemeProps } from 'mol-view/theme/size'; export interface ElementSphereMeshProps { sizeTheme: SizeThemeProps, diff --git a/src/mol-geo/theme/index.ts b/src/mol-geo/theme/index.ts deleted file mode 100644 index 0f08e600df3b1b08debc471c970e4aa01148416b..0000000000000000000000000000000000000000 --- a/src/mol-geo/theme/index.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. - * - * @author Alexander Rose <alexander.rose@weirdbyte.de> - */ - -import { Color } from 'mol-util/color'; -import { Structure } from 'mol-model/structure'; - -export interface ColorThemeProps { - name: 'element-index' | 'chain-id'| 'unit-index' | 'uniform' | 'carbohydrate-symbol' | 'element-symbol' - domain?: [number, number] - value?: Color - structure?: Structure -} - -export const ColorThemeInfo = { - 'element-index': {}, - 'carbohydrate-symbol': {}, - 'chain-id': {}, - 'element-symbol': {}, - 'unit-index': {}, - 'uniform': {} -} -export type ColorThemeName = keyof typeof ColorThemeInfo -export const ColorThemeNames = Object.keys(ColorThemeInfo) - -// - -export interface SizeThemeProps { - name: 'physical' | 'uniform' - value?: number - factor?: number - structure?: Structure -} - -export const SizeThemeInfo = { - 'physical': {}, - 'uniform': {} -} -export type SizeThemeName = keyof typeof SizeThemeInfo -export const SizeThemeNames = Object.keys(SizeThemeInfo) \ No newline at end of file diff --git a/src/mol-geo/theme/structure/color/index.ts b/src/mol-geo/theme/structure/color/index.ts deleted file mode 100644 index 70da74a020e9bc97bf140770f02775b322d26c2b..0000000000000000000000000000000000000000 --- a/src/mol-geo/theme/structure/color/index.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. - * - * @author Alexander Rose <alexander.rose@weirdbyte.de> - */ - -import { ColorThemeProps } from '../..'; - -import { ElementIndexColorTheme } from './element-index'; -import { CarbohydrateSymbolColorTheme } from './carbohydrate-symbol'; -import { ChainIdColorTheme } from './chain-id'; -import { ElementSymbolColorTheme } from './element-symbol'; -import { UnitIndexColorTheme } from './unit-index'; -import { UniformColorTheme } from './uniform'; -import { ColorType, LocationColor } from '../../../util/color-data'; - -export interface ColorTheme { - kind: ColorType - color: LocationColor -} - -export function ColorTheme(props: ColorThemeProps): ColorTheme { - switch (props.name) { - case 'element-index': return ElementIndexColorTheme(props) - case 'carbohydrate-symbol': return CarbohydrateSymbolColorTheme(props) - case 'chain-id': return ChainIdColorTheme(props) - case 'element-symbol': return ElementSymbolColorTheme(props) - case 'unit-index': return UnitIndexColorTheme(props) - case 'uniform': return UniformColorTheme(props) - } -} \ No newline at end of file diff --git a/src/mol-geo/theme/structure/size/index.ts b/src/mol-geo/theme/structure/size/index.ts deleted file mode 100644 index a67c32e8c41352282471719fee679fa2a8eaf6c2..0000000000000000000000000000000000000000 --- a/src/mol-geo/theme/structure/size/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. - * - * @author Alexander Rose <alexander.rose@weirdbyte.de> - */ - -import { SizeType, LocationSize } from '../../../util/size-data'; -import { SizeThemeProps } from '../..'; -import { PhysicalSizeTheme } from './physical'; -import { UniformSizeTheme } from './uniform'; - -export interface SizeTheme { - kind: SizeType - size: LocationSize -} - -export function SizeTheme(props: SizeThemeProps): SizeTheme { - switch (props.name) { - case 'physical': return PhysicalSizeTheme(props) - case 'uniform': return UniformSizeTheme(props) - } -} \ No newline at end of file diff --git a/src/mol-view/theme/color.ts b/src/mol-view/theme/color.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7ef557a5e6a797ddff28d03df065fa5a9932861 --- /dev/null +++ b/src/mol-view/theme/color.ts @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +import { Color } from 'mol-util/color'; +import { Structure } from 'mol-model/structure'; +import { ColorType, LocationColor } from 'mol-geo/util/color-data'; + +import { ElementIndexColorTheme } from './color/element-index'; +import { CarbohydrateSymbolColorTheme } from './color/carbohydrate-symbol'; +import { ChainIdColorTheme } from './color/chain-id'; +import { ElementSymbolColorTheme } from './color/element-symbol'; +import { UnitIndexColorTheme } from './color/unit-index'; +import { UniformColorTheme } from './color/uniform'; + +export interface ColorTheme { + kind: ColorType + color: LocationColor +} + +export function ColorTheme(props: ColorThemeProps): ColorTheme { + switch (props.name) { + case 'element-index': return ElementIndexColorTheme(props) + case 'carbohydrate-symbol': return CarbohydrateSymbolColorTheme(props) + case 'chain-id': return ChainIdColorTheme(props) + case 'element-symbol': return ElementSymbolColorTheme(props) + case 'unit-index': return UnitIndexColorTheme(props) + case 'uniform': return UniformColorTheme(props) + } +} + +export interface ColorThemeProps { + name: 'element-index' | 'chain-id'| 'unit-index' | 'uniform' | 'carbohydrate-symbol' | 'element-symbol' + domain?: [number, number] + value?: Color + structure?: Structure +} + +export const ColorThemeInfo = { + 'element-index': {}, + 'carbohydrate-symbol': {}, + 'chain-id': {}, + 'element-symbol': {}, + 'unit-index': {}, + 'uniform': {} +} +export type ColorThemeName = keyof typeof ColorThemeInfo +export const ColorThemeNames = Object.keys(ColorThemeInfo) \ No newline at end of file diff --git a/src/mol-geo/theme/structure/color/carbohydrate-symbol.ts b/src/mol-view/theme/color/carbohydrate-symbol.ts similarity index 93% rename from src/mol-geo/theme/structure/color/carbohydrate-symbol.ts rename to src/mol-view/theme/color/carbohydrate-symbol.ts index d6487d50ce7ab85fb5d87457501f1192e6412ca7..5bdb28204330dab0df8e2693c5afad9de67b3379 100644 --- a/src/mol-geo/theme/structure/color/carbohydrate-symbol.ts +++ b/src/mol-view/theme/color/carbohydrate-symbol.ts @@ -6,11 +6,10 @@ import { StructureElement, Link, ElementIndex, Unit } from 'mol-model/structure'; -import { ColorThemeProps } from '../..'; import { SaccharideColors } from 'mol-model/structure/structure/carbohydrates/constants'; import { Location } from 'mol-model/location'; -import { ColorTheme } from '.'; -import { LocationColor } from '../../../util/color-data'; +import { ColorThemeProps, ColorTheme } from '../color'; +import { LocationColor } from 'mol-geo/util/color-data'; const DefaultColor = 0xCCCCCC; diff --git a/src/mol-geo/theme/structure/color/chain-id.ts b/src/mol-view/theme/color/chain-id.ts similarity index 95% rename from src/mol-geo/theme/structure/color/chain-id.ts rename to src/mol-view/theme/color/chain-id.ts index 32d347a1d9c26073bebf0c2fa5d26ab856a5f93a..e4f6e0c245a940ef483b50fedc5b6789a6cebeb6 100644 --- a/src/mol-geo/theme/structure/color/chain-id.ts +++ b/src/mol-view/theme/color/chain-id.ts @@ -8,8 +8,7 @@ import { Unit, StructureProperties, StructureElement, Link } from 'mol-model/str import { ColorScale, Color } from 'mol-util/color'; import { Location } from 'mol-model/location'; -import { ColorThemeProps } from '../..'; -import { ColorTheme } from '.'; +import { ColorThemeProps, ColorTheme } from '../color'; function getAsymId(unit: Unit): StructureElement.Property<string> { switch (unit.kind) { diff --git a/src/mol-geo/theme/structure/color/element-index.ts b/src/mol-view/theme/color/element-index.ts similarity index 93% rename from src/mol-geo/theme/structure/color/element-index.ts rename to src/mol-view/theme/color/element-index.ts index 388d4ce1c41c8e57749eb496006cf91b6551e362..6f27bb6054d5f7fb2e9c235d72f865728a6830bd 100644 --- a/src/mol-geo/theme/structure/color/element-index.ts +++ b/src/mol-view/theme/color/element-index.ts @@ -6,11 +6,10 @@ import { ColorScale, Color } from 'mol-util/color'; import { Location } from 'mol-model/location'; -import { ColorThemeProps } from '../..'; import { StructureElement, Link, Unit } from 'mol-model/structure'; import { OrderedSet } from 'mol-data/int'; -import { ColorTheme } from '.'; -import { LocationColor } from '../../../util/color-data'; +import { LocationColor } from 'mol-geo/util/color-data'; +import { ColorThemeProps, ColorTheme } from '../color'; const DefaultColor = 0xCCCCCC; diff --git a/src/mol-geo/theme/structure/color/element-symbol.ts b/src/mol-view/theme/color/element-symbol.ts similarity index 97% rename from src/mol-geo/theme/structure/color/element-symbol.ts rename to src/mol-view/theme/color/element-symbol.ts index 009aac7238dd3a1103200ec2338cc35f2eef8b90..1bc7f95eac18b2caa930fcca155988d80cb77478 100644 --- a/src/mol-geo/theme/structure/color/element-symbol.ts +++ b/src/mol-view/theme/color/element-symbol.ts @@ -8,8 +8,7 @@ import { ElementSymbol } from 'mol-model/structure/model/types'; import { Color } from 'mol-util/color'; import { StructureElement, Unit, Link } from 'mol-model/structure'; import { Location } from 'mol-model/location'; -import { ColorThemeProps } from '../..'; -import { ColorTheme } from '.'; +import { ColorThemeProps, ColorTheme } from '../color'; // from Jmol http://jmol.sourceforge.net/jscolors/ (or 0xFFFFFF) export const ElementSymbolColors: { [k: string]: Color } = { diff --git a/src/mol-geo/theme/structure/color/uniform.ts b/src/mol-view/theme/color/uniform.ts similarity index 84% rename from src/mol-geo/theme/structure/color/uniform.ts rename to src/mol-view/theme/color/uniform.ts index 2c1e700cf5adb8308fb36a66aae2830b152b7588..bfc13f32c1d4d2491f303a0984d51444493a2035 100644 --- a/src/mol-geo/theme/structure/color/uniform.ts +++ b/src/mol-view/theme/color/uniform.ts @@ -4,8 +4,7 @@ * @author Alexander Rose <alexander.rose@weirdbyte.de> */ -import { ColorThemeProps } from '../..'; -import { ColorTheme } from '.'; +import { ColorTheme, ColorThemeProps } from '../color'; const DefaultColor = 0xCCCCCC; diff --git a/src/mol-geo/theme/structure/color/unit-index.ts b/src/mol-view/theme/color/unit-index.ts similarity index 89% rename from src/mol-geo/theme/structure/color/unit-index.ts rename to src/mol-view/theme/color/unit-index.ts index d77021e47faf8a592f249e0635cf9faf5c52f21e..91f0465267d86d6856d97f302f17780a4dcc9549 100644 --- a/src/mol-geo/theme/structure/color/unit-index.ts +++ b/src/mol-view/theme/color/unit-index.ts @@ -6,10 +6,9 @@ import { ColorScale, Color } from 'mol-util/color'; import { Location } from 'mol-model/location'; -import { ColorThemeProps } from '../..'; import { Unit, StructureElement, Link } from 'mol-model/structure'; -import { ColorTheme } from '.'; -import { LocationColor } from '../../../util/color-data'; +import { LocationColor } from 'mol-geo/util/color-data'; +import { ColorTheme, ColorThemeProps } from '../color'; const DefaultColor = 0xCCCCCC; diff --git a/src/mol-view/theme/size.ts b/src/mol-view/theme/size.ts new file mode 100644 index 0000000000000000000000000000000000000000..059c8b04fbf5a4d3bd767c1c8e04cd86e490a372 --- /dev/null +++ b/src/mol-view/theme/size.ts @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +import { Structure } from 'mol-model/structure'; +import { SizeType, LocationSize } from 'mol-geo/util/size-data'; + +import { PhysicalSizeTheme } from './size/physical'; +import { UniformSizeTheme } from './size/uniform'; + +export interface SizeTheme { + kind: SizeType + size: LocationSize +} + +export function SizeTheme(props: SizeThemeProps): SizeTheme { + switch (props.name) { + case 'physical': return PhysicalSizeTheme(props) + case 'uniform': return UniformSizeTheme(props) + } +} + +export interface SizeThemeProps { + name: 'physical' | 'uniform' + value?: number + factor?: number + structure?: Structure +} + +export const SizeThemeInfo = { + 'physical': {}, + 'uniform': {} +} +export type SizeThemeName = keyof typeof SizeThemeInfo +export const SizeThemeNames = Object.keys(SizeThemeInfo) \ No newline at end of file diff --git a/src/mol-geo/theme/structure/size/physical.ts b/src/mol-view/theme/size/physical.ts similarity index 95% rename from src/mol-geo/theme/structure/size/physical.ts rename to src/mol-view/theme/size/physical.ts index 1e62e4847fde40deb8adc5eb96b412ec88dd8946..9ed52cf064a372a10f9ea562905c07269ea649b5 100644 --- a/src/mol-geo/theme/structure/size/physical.ts +++ b/src/mol-view/theme/size/physical.ts @@ -6,8 +6,7 @@ import { StructureElement, Unit, StructureProperties, Link } from 'mol-model/structure'; import { Location } from 'mol-model/location'; -import { SizeTheme } from '.'; -import { SizeThemeProps } from '../..'; +import { SizeThemeProps, SizeTheme } from '../size'; const DefaultSize = 1 const DefaultFactor = 1 diff --git a/src/mol-geo/theme/structure/size/uniform.ts b/src/mol-view/theme/size/uniform.ts similarity index 86% rename from src/mol-geo/theme/structure/size/uniform.ts rename to src/mol-view/theme/size/uniform.ts index e75b2a0797a352b200f36f78c3fffe70fccc1f2d..f9810f2e72591b46a0dfd626a9863adc30f3f9bd 100644 --- a/src/mol-geo/theme/structure/size/uniform.ts +++ b/src/mol-view/theme/size/uniform.ts @@ -4,8 +4,7 @@ * @author Alexander Rose <alexander.rose@weirdbyte.de> */ -import { SizeThemeProps } from '../..'; -import { SizeTheme } from '.'; +import { SizeTheme, SizeThemeProps } from '../size'; const DefaultSize = 1 const DefaultFactor = 1