diff --git a/CHANGELOG.md b/CHANGELOG.md index b4db179818e9737f01fb45474f49171cbb606499..769a3430273238579cc275f4e4396cd5dd413064 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,9 +10,10 @@ Note that since we don't clearly distinguish between a public and private interf - Add `SdfFormat` and update SDF parser to be able to parse data headers according to spec (hopefully :)) #230 - Fix mononucleotides detected as polymer components (#229) - Set default outline scale back to 1 -- Improved DCD reader cell angle handling (intepret near 0 angles as 90 deg) +- Improved DCD reader cell angle handling (interpret near 0 angles as 90 deg) - Handle more residue/atom names commonly used in force-fields - Add USDZ support to ``geo-export`` extension. +- Fix `includeParent` support for multi-instance bond visuals. ## [v2.1.0] - 2021-07-05 diff --git a/src/extensions/dnatco/confal-pyramids/representation.ts b/src/extensions/dnatco/confal-pyramids/representation.ts index ebb936e625122b9f4aae9a19d08e9eb1e6a96887..b0ce90b53e355ad33fcf2379bbe4445949868ed8 100644 --- a/src/extensions/dnatco/confal-pyramids/representation.ts +++ b/src/extensions/dnatco/confal-pyramids/representation.ts @@ -20,10 +20,10 @@ import { Structure, StructureProperties, Unit } from '../../../mol-model/structu import { CustomProperty } from '../../../mol-model-props/common/custom-property'; import { Representation, RepresentationContext, RepresentationParamsGetter } from '../../../mol-repr/representation'; import { StructureRepresentation, StructureRepresentationProvider, StructureRepresentationStateBuilder, UnitsRepresentation } from '../../../mol-repr/structure/representation'; -import { StructureGroup, UnitsMeshParams, UnitsMeshVisual, UnitsVisual } from '../../../mol-repr/structure/units-visual'; +import { UnitsMeshParams, UnitsMeshVisual, UnitsVisual } from '../../../mol-repr/structure/units-visual'; import { VisualUpdateState } from '../../../mol-repr/util'; import { VisualContext } from '../../../mol-repr/visual'; -import { getAltResidueLociFromId } from '../../../mol-repr/structure/visual/util/common'; +import { getAltResidueLociFromId, StructureGroup } from '../../../mol-repr/structure/visual/util/common'; import { ParamDefinition as PD } from '../../../mol-util/param-definition'; import { Theme, ThemeRegistryContext } from '../../../mol-theme/theme'; import { NullLocation } from '../../../mol-model/location'; diff --git a/src/extensions/rcsb/validation-report/representation.ts b/src/extensions/rcsb/validation-report/representation.ts index 3e2c4406ade4ff53125ac42df6dc0dca1c13203b..b65f771b519268c38d2d41712f3f9ff4d5f4ff6d 100644 --- a/src/extensions/rcsb/validation-report/representation.ts +++ b/src/extensions/rcsb/validation-report/representation.ts @@ -16,7 +16,7 @@ import { RepresentationContext, RepresentationParamsGetter, Representation } fro import { UnitsRepresentation, StructureRepresentation, StructureRepresentationStateBuilder, StructureRepresentationProvider, ComplexRepresentation } from '../../../mol-repr/structure/representation'; import { VisualContext } from '../../../mol-repr/visual'; import { createLinkCylinderMesh, LinkCylinderParams, LinkStyle } from '../../../mol-repr/structure/visual/util/link'; -import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual, StructureGroup } from '../../../mol-repr/structure/units-visual'; +import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual } from '../../../mol-repr/structure/units-visual'; import { VisualUpdateState } from '../../../mol-repr/util'; import { LocationIterator } from '../../../mol-geo/util/location-iterator'; import { ClashesProvider, IntraUnitClashes, InterUnitClashes, ValidationReport } from './prop'; @@ -28,6 +28,7 @@ import { CentroidHelper } from '../../../mol-math/geometry/centroid-helper'; import { Sphere3D } from '../../../mol-math/geometry'; import { bondLabel } from '../../../mol-theme/label'; import { getUnitKindsParam } from '../../../mol-repr/structure/params'; +import { StructureGroup } from '../../../mol-repr/structure/visual/util/common'; // diff --git a/src/mol-geo/geometry/spheres/spheres.ts b/src/mol-geo/geometry/spheres/spheres.ts index 14b52ca7ad09bbbc4c843b76f403adea7b849535..3163a0961e2bc88b131ad619e60a11c9be80311d 100644 --- a/src/mol-geo/geometry/spheres/spheres.ts +++ b/src/mol-geo/geometry/spheres/spheres.ts @@ -163,9 +163,6 @@ export namespace Spheres { function createValues(spheres: Spheres, transform: TransformData, locationIt: LocationIterator, theme: Theme, props: PD.Values<Params>): SpheresValues { const { instanceCount, groupCount } = locationIt; - if (instanceCount !== transform.instanceCount.ref.value) { - throw new Error('instanceCount values in TransformData and LocationIterator differ'); - } const positionIt = createPositionIterator(spheres, transform); const color = createColors(locationIt, positionIt, theme.color); diff --git a/src/mol-geo/geometry/text/text.ts b/src/mol-geo/geometry/text/text.ts index b0f3f51fa6de79854026e2bffb9b48cc28b04220..cd4e2071984a75d43fca0725bc5b69d537e58b6a 100644 --- a/src/mol-geo/geometry/text/text.ts +++ b/src/mol-geo/geometry/text/text.ts @@ -206,9 +206,6 @@ export namespace Text { function createValues(text: Text, transform: TransformData, locationIt: LocationIterator, theme: Theme, props: PD.Values<Params>): TextValues { const { instanceCount, groupCount } = locationIt; - if (instanceCount !== transform.instanceCount.ref.value) { - throw new Error('instanceCount values in TransformData and LocationIterator differ'); - } const positionIt = createPositionIterator(text, transform); const color = createColors(locationIt, positionIt, theme.color); diff --git a/src/mol-model-props/computed/representations/interactions-intra-unit-cylinder.ts b/src/mol-model-props/computed/representations/interactions-intra-unit-cylinder.ts index d67a852799346f342e74d33ce8910caec57621b7..ed89ee955eba16b76634829e06ab84bc0cf771f4 100644 --- a/src/mol-model-props/computed/representations/interactions-intra-unit-cylinder.ts +++ b/src/mol-model-props/computed/representations/interactions-intra-unit-cylinder.ts @@ -15,12 +15,13 @@ import { VisualContext } from '../../../mol-repr/visual'; import { Theme } from '../../../mol-theme/theme'; import { InteractionsProvider } from '../interactions'; import { createLinkCylinderMesh, LinkCylinderParams, LinkStyle } from '../../../mol-repr/structure/visual/util/link'; -import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual, StructureGroup } from '../../../mol-repr/structure/units-visual'; +import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual } from '../../../mol-repr/structure/units-visual'; import { VisualUpdateState } from '../../../mol-repr/util'; import { LocationIterator } from '../../../mol-geo/util/location-iterator'; import { Interactions } from '../interactions/interactions'; import { InteractionFlag } from '../interactions/common'; import { Sphere3D } from '../../../mol-math/geometry'; +import { StructureGroup } from '../../../mol-repr/structure/visual/util/common'; async function createIntraUnitInteractionsCylinderMesh(ctx: VisualContext, unit: Unit, structure: Structure, theme: Theme, props: PD.Values<InteractionsIntraUnitParams>, mesh?: Mesh) { if (!Unit.isAtomic(unit)) return Mesh.createEmpty(mesh); diff --git a/src/mol-repr/structure/params.ts b/src/mol-repr/structure/params.ts index 162e75dffc7568268a2e0475507a234fbe8946ad..a838ccb2433c1ad8f2ff51a004c40c5e1096093b 100644 --- a/src/mol-repr/structure/params.ts +++ b/src/mol-repr/structure/params.ts @@ -22,6 +22,7 @@ export function getUnitKindsParam(defaultValue: UnitKind[]) { export const StructureParams = { unitKinds: getUnitKindsParam(['atomic', 'spheres']), + includeParent: PD.Boolean(false, { isHidden: true }), }; export type StructureParams = typeof StructureParams diff --git a/src/mol-repr/structure/representation/ball-and-stick.ts b/src/mol-repr/structure/representation/ball-and-stick.ts index 70eb3ab0476230563e4694aee1ae17ff92cc3e08..ee043e08dc363f7c50a5e56920d8b8433de02f4b 100644 --- a/src/mol-repr/structure/representation/ball-and-stick.ts +++ b/src/mol-repr/structure/representation/ball-and-stick.ts @@ -27,6 +27,7 @@ export const BallAndStickParams = { traceOnly: PD.Boolean(false, { isHidden: true }), // not useful here ...IntraUnitBondCylinderParams, ...InterUnitBondCylinderParams, + includeParent: PD.Boolean(false), unitKinds: getUnitKindsParam(['atomic']), sizeFactor: PD.Numeric(0.15, { min: 0.01, max: 10, step: 0.01 }), sizeAspectRatio: PD.Numeric(2 / 3, { min: 0.01, max: 3, step: 0.01 }), diff --git a/src/mol-repr/structure/representation/line.ts b/src/mol-repr/structure/representation/line.ts index 013677e009d05d2cf9dab9e8e39c1f10fc374aab..2f9c5c5d6e03c692f5069e94f82a2db80f4cd797 100644 --- a/src/mol-repr/structure/representation/line.ts +++ b/src/mol-repr/structure/representation/line.ts @@ -23,6 +23,7 @@ const LineVisuals = { export const LineParams = { ...IntraUnitBondLineParams, ...InterUnitBondLineParams, + includeParent: PD.Boolean(false), sizeFactor: PD.Numeric(1.5, { min: 0.01, max: 10, step: 0.01 }), unitKinds: getUnitKindsParam(['atomic']), visuals: PD.MultiSelect(['intra-bond', 'inter-bond'], PD.objectToOptions(LineVisuals)) diff --git a/src/mol-repr/structure/units-representation.ts b/src/mol-repr/structure/units-representation.ts index 3c9b3305c5d362877b4b6a96e33aa19605dacbe8..d784e37afd272dbe4c730477e320f667bc850ba3 100644 --- a/src/mol-repr/structure/units-representation.ts +++ b/src/mol-repr/structure/units-representation.ts @@ -8,7 +8,6 @@ import { ParamDefinition as PD } from '../../mol-util/param-definition'; import { StructureRepresentation, StructureRepresentationStateBuilder, StructureRepresentationState } from './representation'; import { Visual } from '../visual'; -import { StructureGroup } from './units-visual'; import { RepresentationContext, RepresentationParamsGetter } from '../representation'; import { Structure, Unit, StructureElement, Bond } from '../../mol-model/structure'; import { Subject } from 'rxjs'; @@ -25,6 +24,7 @@ import { Interval } from '../../mol-data/int'; import { StructureParams } from './params'; import { Clipping } from '../../mol-theme/clipping'; import { WebGLContext } from '../../mol-gl/webgl/context'; +import { StructureGroup } from './visual/util/common'; export interface UnitsVisual<P extends StructureParams> extends Visual<StructureGroup, P> { } diff --git a/src/mol-repr/structure/units-visual.ts b/src/mol-repr/structure/units-visual.ts index 92ccd37e006661476dbff7ea9939935a6c30c538..fd28a68df566f079482e74d7e1741009849fc20c 100644 --- a/src/mol-repr/structure/units-visual.ts +++ b/src/mol-repr/structure/units-visual.ts @@ -11,7 +11,7 @@ import { Visual, VisualContext } from '../visual'; import { Geometry, GeometryUtils } from '../../mol-geo/geometry/geometry'; import { LocationIterator } from '../../mol-geo/util/location-iterator'; import { Theme } from '../../mol-theme/theme'; -import { createUnitsTransform, includesUnitKind } from './visual/util/common'; +import { createUnitsTransform, includesUnitKind, StructureGroup } from './visual/util/common'; import { createRenderObject, GraphicsRenderObject, RenderObjectValues } from '../../mol-gl/render-object'; import { PickingId } from '../../mol-geo/geometry/picking'; import { Loci, isEveryLoci, EmptyLoci } from '../../mol-model/loci'; @@ -41,13 +41,11 @@ import { Clipping } from '../../mol-theme/clipping'; import { WebGLContext } from '../../mol-gl/webgl/context'; import { isPromiseLike } from '../../mol-util/type-helpers'; -export type StructureGroup = { structure: Structure, group: Unit.SymmetryGroup } - export interface UnitsVisual<P extends RepresentationProps = {}> extends Visual<StructureGroup, P> { } -function createUnitsRenderObject<G extends Geometry>(group: Unit.SymmetryGroup, geometry: G, locationIt: LocationIterator, theme: Theme, props: PD.Values<Geometry.Params<G>>, materialId: number) { +function createUnitsRenderObject<G extends Geometry>(structureGroup: StructureGroup, geometry: G, locationIt: LocationIterator, theme: Theme, props: PD.Values<StructureParams & Geometry.Params<G>>, materialId: number) { const { createValues, createRenderableState } = Geometry.getUtils(geometry); - const transform = createUnitsTransform(group); + const transform = createUnitsTransform(structureGroup, props.includeParent); const values = createValues(geometry, transform, locationIt, theme, props); const state = createRenderableState(props); return createRenderObject(geometry.kind, values, state, materialId); @@ -179,7 +177,7 @@ export function UnitsVisual<G extends Geometry, P extends StructureParams & Geom if (updateState.createNew) { locationIt = createLocationIterator(newStructureGroup); if (newGeometry) { - renderObject = createUnitsRenderObject(newStructureGroup.group, newGeometry, locationIt, newTheme, newProps, materialId); + renderObject = createUnitsRenderObject(newStructureGroup, newGeometry, locationIt, newTheme, newProps, materialId); positionIt = createPositionIterator(newGeometry, renderObject.values); } else { throw new Error('expected geometry to be given'); @@ -198,7 +196,7 @@ export function UnitsVisual<G extends Geometry, P extends StructureParams & Geom if (updateState.updateMatrix) { // console.log('update matrix'); - createUnitsTransform(newStructureGroup.group, renderObject.values); + createUnitsTransform(newStructureGroup, newProps.includeParent, renderObject.values); } if (updateState.createGeometry) { diff --git a/src/mol-repr/structure/visual/bond-intra-unit-cylinder.ts b/src/mol-repr/structure/visual/bond-intra-unit-cylinder.ts index cd10168f017acbc9e1dce0677982e6220f1aec3a..7aae65c38506e4d340f3732ff5c46f0d0e250488 100644 --- a/src/mol-repr/structure/visual/bond-intra-unit-cylinder.ts +++ b/src/mol-repr/structure/visual/bond-intra-unit-cylinder.ts @@ -13,7 +13,7 @@ import { Mesh } from '../../../mol-geo/geometry/mesh/mesh'; import { Vec3 } from '../../../mol-math/linear-algebra'; import { arrayEqual } from '../../../mol-util'; import { createLinkCylinderImpostors, createLinkCylinderMesh, LinkBuilderProps, LinkStyle } from './util/link'; -import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual, StructureGroup, UnitsCylindersParams, UnitsCylindersVisual } from '../units-visual'; +import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual, UnitsCylindersParams, UnitsCylindersVisual } from '../units-visual'; import { VisualUpdateState } from '../../util'; import { BondType } from '../../../mol-model/structure/model/types'; import { BondCylinderParams, BondIterator, eachIntraBond, getIntraBondLoci, makeIntraBondIgnoreTest } from './util/bond'; @@ -23,6 +23,7 @@ import { WebGLContext } from '../../../mol-gl/webgl/context'; import { Cylinders } from '../../../mol-geo/geometry/cylinders/cylinders'; import { SortedArray } from '../../../mol-data/int'; import { arrayIntersectionSize } from '../../../mol-util/array'; +import { StructureGroup } from './util/common'; // avoiding namespace lookup improved performance in Chrome (Aug 2020) const isBondType = BondType.is; diff --git a/src/mol-repr/structure/visual/bond-intra-unit-line.ts b/src/mol-repr/structure/visual/bond-intra-unit-line.ts index 8cc4cbeee1e185b4af7cbd516a3be94bcdf053e2..f55e7eb0d687f944f1431e07589789c0c6a4b44e 100644 --- a/src/mol-repr/structure/visual/bond-intra-unit-line.ts +++ b/src/mol-repr/structure/visual/bond-intra-unit-line.ts @@ -11,7 +11,7 @@ import { Theme } from '../../../mol-theme/theme'; import { Vec3 } from '../../../mol-math/linear-algebra'; import { arrayEqual } from '../../../mol-util'; import { LinkStyle, createLinkLines, LinkBuilderProps } from './util/link'; -import { UnitsVisual, UnitsLinesParams, UnitsLinesVisual, StructureGroup } from '../units-visual'; +import { UnitsVisual, UnitsLinesParams, UnitsLinesVisual } from '../units-visual'; import { VisualUpdateState } from '../../util'; import { BondType } from '../../../mol-model/structure/model/types'; import { BondIterator, BondLineParams, getIntraBondLoci, eachIntraBond, makeIntraBondIgnoreTest } from './util/bond'; @@ -19,6 +19,7 @@ import { Sphere3D } from '../../../mol-math/geometry'; import { Lines } from '../../../mol-geo/geometry/lines/lines'; import { IntAdjacencyGraph } from '../../../mol-math/graph'; import { arrayIntersectionSize } from '../../../mol-util/array'; +import { StructureGroup } from './util/common'; // avoiding namespace lookup improved performance in Chrome (Aug 2020) const isBondType = BondType.is; diff --git a/src/mol-repr/structure/visual/element-sphere.ts b/src/mol-repr/structure/visual/element-sphere.ts index def4843cb26a0bdb223c6eb35b971ee677461675..e7fc70aa05915aa37240e705ef41c1f265c08e45 100644 --- a/src/mol-repr/structure/visual/element-sphere.ts +++ b/src/mol-repr/structure/visual/element-sphere.ts @@ -6,12 +6,13 @@ */ import { ParamDefinition as PD } from '../../../mol-util/param-definition'; -import { UnitsMeshParams, UnitsSpheresParams, UnitsVisual, UnitsSpheresVisual, UnitsMeshVisual, StructureGroup } from '../units-visual'; +import { UnitsMeshParams, UnitsSpheresParams, UnitsVisual, UnitsSpheresVisual, UnitsMeshVisual } from '../units-visual'; import { WebGLContext } from '../../../mol-gl/webgl/context'; import { createElementSphereImpostor, ElementIterator, getElementLoci, eachElement, createElementSphereMesh } from './util/element'; import { VisualUpdateState } from '../../util'; import { BaseGeometry } from '../../../mol-geo/geometry/base'; import { Structure } from '../../../mol-model/structure'; +import { StructureGroup } from './util/common'; export const ElementSphereParams = { ...UnitsMeshParams, diff --git a/src/mol-repr/structure/visual/gaussian-surface-mesh.ts b/src/mol-repr/structure/visual/gaussian-surface-mesh.ts index 51ab5372e6af6a97058f408870c024ecf9637c8a..a63788c9b40a4d2e70105605e6b47d6dbdcbdc53 100644 --- a/src/mol-repr/structure/visual/gaussian-surface-mesh.ts +++ b/src/mol-repr/structure/visual/gaussian-surface-mesh.ts @@ -5,7 +5,7 @@ */ import { ParamDefinition as PD } from '../../../mol-util/param-definition'; -import { UnitsMeshParams, UnitsTextureMeshParams, UnitsVisual, UnitsMeshVisual, UnitsTextureMeshVisual, StructureGroup } from '../units-visual'; +import { UnitsMeshParams, UnitsTextureMeshParams, UnitsVisual, UnitsMeshVisual, UnitsTextureMeshVisual } from '../units-visual'; import { GaussianDensityParams, computeUnitGaussianDensity, computeUnitGaussianDensityTexture2d, GaussianDensityProps, computeStructureGaussianDensity, computeStructureGaussianDensityTexture2d } from './util/gaussian'; import { VisualContext } from '../../visual'; import { Unit, Structure } from '../../../mol-model/structure'; @@ -18,7 +18,7 @@ import { TextureMesh } from '../../../mol-geo/geometry/texture-mesh/texture-mesh import { extractIsosurface } from '../../../mol-gl/compute/marching-cubes/isosurface'; import { Sphere3D } from '../../../mol-math/geometry'; import { ComplexVisual, ComplexMeshParams, ComplexMeshVisual, ComplexTextureMeshVisual, ComplexTextureMeshParams } from '../complex-visual'; -import { getUnitExtraRadius, getStructureExtraRadius, getVolumeSliceInfo } from './util/common'; +import { getUnitExtraRadius, getStructureExtraRadius, getVolumeSliceInfo, StructureGroup } from './util/common'; import { WebGLContext } from '../../../mol-gl/webgl/context'; import { MeshValues } from '../../../mol-gl/renderable/mesh'; import { TextureMeshValues } from '../../../mol-gl/renderable/texture-mesh'; diff --git a/src/mol-repr/structure/visual/orientation-ellipsoid-mesh.ts b/src/mol-repr/structure/visual/orientation-ellipsoid-mesh.ts index 717efa5bc3f1a386cc2d437f0942d39ffc3a3af5..76e355547db7674c6f626f20c89a69b82260aadb 100644 --- a/src/mol-repr/structure/visual/orientation-ellipsoid-mesh.ts +++ b/src/mol-repr/structure/visual/orientation-ellipsoid-mesh.ts @@ -5,7 +5,7 @@ */ import { ParamDefinition as PD } from '../../../mol-util/param-definition'; -import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual, StructureGroup } from '../../../mol-repr/structure/units-visual'; +import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual } from '../../../mol-repr/structure/units-visual'; import { VisualUpdateState } from '../../../mol-repr/util'; import { VisualContext } from '../../../mol-repr/visual'; import { Unit, Structure, StructureElement } from '../../../mol-model/structure'; @@ -22,6 +22,7 @@ import { UnitIndex } from '../../../mol-model/structure/structure/element/elemen import { LocationIterator } from '../../../mol-geo/util/location-iterator'; import { MoleculeType } from '../../../mol-model/structure/model/types'; import { BaseGeometry } from '../../../mol-geo/geometry/base'; +import { StructureGroup } from './util/common'; export const OrientationEllipsoidMeshParams = { ...UnitsMeshParams, diff --git a/src/mol-repr/structure/visual/polymer-backbone-cylinder.ts b/src/mol-repr/structure/visual/polymer-backbone-cylinder.ts index accf0d45e8d2d3f4b9dd31f68770f14d61cc68c0..249f55348882aba67983268c023bc8733276564a 100644 --- a/src/mol-repr/structure/visual/polymer-backbone-cylinder.ts +++ b/src/mol-repr/structure/visual/polymer-backbone-cylinder.ts @@ -14,7 +14,7 @@ import { Vec3 } from '../../../mol-math/linear-algebra'; import { CylinderProps } from '../../../mol-geo/primitive/cylinder'; import { eachPolymerElement, getPolymerElementLoci, NucleicShift, PolymerLocationIterator, StandardShift } from './util/polymer'; import { addCylinder } from '../../../mol-geo/geometry/mesh/builder/cylinder'; -import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual, UnitsCylindersVisual, UnitsCylindersParams, StructureGroup } from '../units-visual'; +import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual, UnitsCylindersVisual, UnitsCylindersParams } from '../units-visual'; import { VisualUpdateState } from '../../util'; import { BaseGeometry } from '../../../mol-geo/geometry/base'; import { Sphere3D } from '../../../mol-math/geometry'; @@ -23,6 +23,7 @@ import { WebGLContext } from '../../../mol-gl/webgl/context'; import { Cylinders } from '../../../mol-geo/geometry/cylinders/cylinders'; import { CylindersBuilder } from '../../../mol-geo/geometry/cylinders/cylinders-builder'; import { eachPolymerBackboneLink } from './util/polymer/backbone'; +import { StructureGroup } from './util/common'; // avoiding namespace lookup improved performance in Chrome (Aug 2020) const v3scale = Vec3.scale; diff --git a/src/mol-repr/structure/visual/polymer-backbone-sphere.ts b/src/mol-repr/structure/visual/polymer-backbone-sphere.ts index 9557e22b998c473cafa93a30f4b5af08c11a59cc..d09dbe1f97e26211e5975f3922c92a1582d9cb2c 100644 --- a/src/mol-repr/structure/visual/polymer-backbone-sphere.ts +++ b/src/mol-repr/structure/visual/polymer-backbone-sphere.ts @@ -12,7 +12,7 @@ import { Mesh } from '../../../mol-geo/geometry/mesh/mesh'; import { MeshBuilder } from '../../../mol-geo/geometry/mesh/mesh-builder'; import { Vec3 } from '../../../mol-math/linear-algebra'; import { eachPolymerElement, getPolymerElementLoci, PolymerLocationIterator } from './util/polymer'; -import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual, UnitsSpheresVisual, UnitsSpheresParams, StructureGroup } from '../units-visual'; +import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual, UnitsSpheresVisual, UnitsSpheresParams } from '../units-visual'; import { VisualUpdateState } from '../../util'; import { BaseGeometry } from '../../../mol-geo/geometry/base'; import { Sphere3D } from '../../../mol-math/geometry'; @@ -22,6 +22,7 @@ import { WebGLContext } from '../../../mol-gl/webgl/context'; import { Spheres } from '../../../mol-geo/geometry/spheres/spheres'; import { SpheresBuilder } from '../../../mol-geo/geometry/spheres/spheres-builder'; import { eachPolymerBackboneElement } from './util/polymer/backbone'; +import { StructureGroup } from './util/common'; export const PolymerBackboneSphereParams = { ...UnitsMeshParams, diff --git a/src/mol-repr/structure/visual/polymer-trace-mesh.ts b/src/mol-repr/structure/visual/polymer-trace-mesh.ts index 52804b34495eac4bc2072dc23f7b67d2b34237fa..416c3f4be26f0565965219b8213de7c75ec544ce 100644 --- a/src/mol-repr/structure/visual/polymer-trace-mesh.ts +++ b/src/mol-repr/structure/visual/polymer-trace-mesh.ts @@ -14,7 +14,7 @@ import { createCurveSegmentState, PolymerTraceIterator, interpolateCurveSegment, import { isNucleic, SecondaryStructureType } from '../../../mol-model/structure/model/types'; import { addSheet } from '../../../mol-geo/geometry/mesh/builder/sheet'; import { addTube } from '../../../mol-geo/geometry/mesh/builder/tube'; -import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual, StructureGroup } from '../units-visual'; +import { UnitsMeshParams, UnitsVisual, UnitsMeshVisual } from '../units-visual'; import { VisualUpdateState } from '../../util'; import { SecondaryStructureProvider } from '../../../mol-model-props/computed/secondary-structure'; import { addRibbon } from '../../../mol-geo/geometry/mesh/builder/ribbon'; @@ -22,6 +22,7 @@ import { addSphere } from '../../../mol-geo/geometry/mesh/builder/sphere'; import { Vec3 } from '../../../mol-math/linear-algebra'; import { BaseGeometry } from '../../../mol-geo/geometry/base'; import { Sphere3D } from '../../../mol-math/geometry'; +import { StructureGroup } from './util/common'; export const PolymerTraceMeshParams = { sizeFactor: PD.Numeric(0.2, { min: 0, max: 10, step: 0.01 }), diff --git a/src/mol-repr/structure/visual/util/bond.ts b/src/mol-repr/structure/visual/util/bond.ts index bd30f742811895785ed108ff6aee567ffabd1a1d..983a7612a9a2ed1ff66010a659320ea1fb2e1c8b 100644 --- a/src/mol-repr/structure/visual/util/bond.ts +++ b/src/mol-repr/structure/visual/util/bond.ts @@ -8,13 +8,12 @@ import { BondType } from '../../../../mol-model/structure/model/types'; import { Unit, StructureElement, Structure, Bond } from '../../../../mol-model/structure'; import { ParamDefinition as PD } from '../../../../mol-util/param-definition'; import { LocationIterator } from '../../../../mol-geo/util/location-iterator'; -import { StructureGroup } from '../../units-visual'; import { LinkCylinderParams, LinkLineParams } from './link'; import { ObjectKeys } from '../../../../mol-util/type-helpers'; import { PickingId } from '../../../../mol-geo/geometry/picking'; import { EmptyLoci, Loci } from '../../../../mol-model/loci'; import { Interval, OrderedSet, SortedArray } from '../../../../mol-data/int'; -import { isH, isHydrogen } from './common'; +import { isH, isHydrogen, StructureGroup } from './common'; export const BondParams = { includeTypes: PD.MultiSelect(ObjectKeys(BondType.Names), PD.objectToOptions(BondType.Names)), diff --git a/src/mol-repr/structure/visual/util/common.ts b/src/mol-repr/structure/visual/util/common.ts index ac7a53dc6816b6353c0e3c440da52d442e981871..89a6f52b8a2a6c589c868a7a7622b985e8ab28c6 100644 --- a/src/mol-repr/structure/visual/util/common.ts +++ b/src/mol-repr/structure/visual/util/common.ts @@ -71,7 +71,13 @@ export function getAltResidueLociFromId(structure: Structure, unit: Unit.Atomic, // -export function createUnitsTransform({ units }: Unit.SymmetryGroup, transformData?: TransformData) { +export type StructureGroup = { structure: Structure, group: Unit.SymmetryGroup } + +export function createUnitsTransform(structureGroup: StructureGroup, includeParent: boolean, transformData?: TransformData) { + const { child } = structureGroup.structure; + const units: ReadonlyArray<Unit> = includeParent && child + ? structureGroup.group.units.filter(u => child.unitMap.has(u.id)) + : structureGroup.group.units; const unitCount = units.length; const n = unitCount * 16; const array = transformData && transformData.aTransform.ref.value.length >= n ? transformData.aTransform.ref.value : new Float32Array(n); diff --git a/src/mol-repr/structure/visual/util/element.ts b/src/mol-repr/structure/visual/util/element.ts index 1c80d73fb52a64e2716b003cce996f69e03c2849..b9a8ea919a3e669edfc8f0921d8456954bd33fe0 100644 --- a/src/mol-repr/structure/visual/util/element.ts +++ b/src/mol-repr/structure/visual/util/element.ts @@ -17,10 +17,9 @@ import { PickingId } from '../../../../mol-geo/geometry/picking'; import { LocationIterator } from '../../../../mol-geo/util/location-iterator'; import { VisualContext } from '../../../../mol-repr/visual'; import { Theme } from '../../../../mol-theme/theme'; -import { StructureGroup } from '../../../../mol-repr/structure/units-visual'; import { Spheres } from '../../../../mol-geo/geometry/spheres/spheres'; import { SpheresBuilder } from '../../../../mol-geo/geometry/spheres/spheres-builder'; -import { isTrace, isH } from './common'; +import { isTrace, isH, StructureGroup } from './common'; import { Sphere3D } from '../../../../mol-math/geometry'; // avoiding namespace lookup improved performance in Chrome (Aug 2020) diff --git a/src/mol-repr/structure/visual/util/nucleotide.ts b/src/mol-repr/structure/visual/util/nucleotide.ts index 60f9d276c8b3e8eacc257e10427f1fff7c230c8f..fe97efd550e43efcd05d3676b9878d68a35a7321 100644 --- a/src/mol-repr/structure/visual/util/nucleotide.ts +++ b/src/mol-repr/structure/visual/util/nucleotide.ts @@ -9,8 +9,7 @@ import { Loci, EmptyLoci } from '../../../../mol-model/loci'; import { Interval } from '../../../../mol-data/int'; import { LocationIterator } from '../../../../mol-geo/util/location-iterator'; import { PickingId } from '../../../../mol-geo/geometry/picking'; -import { StructureGroup } from '../../../../mol-repr/structure/units-visual'; -import { getResidueLoci } from './common'; +import { getResidueLoci, StructureGroup } from './common'; import { eachAtomicUnitTracedElement } from './polymer'; export namespace NucleotideLocationIterator { diff --git a/src/mol-repr/structure/visual/util/polymer.ts b/src/mol-repr/structure/visual/util/polymer.ts index 1311e55f31ee1815ef80e9f23aa46b02d2f35f36..3ba2da690196a90cf3e8140ab4e3fc61167bd1bd 100644 --- a/src/mol-repr/structure/visual/util/polymer.ts +++ b/src/mol-repr/structure/visual/util/polymer.ts @@ -11,8 +11,7 @@ import { OrderedSet, Interval, SortedArray } from '../../../../mol-data/int'; import { EmptyLoci, Loci } from '../../../../mol-model/loci'; import { LocationIterator } from '../../../../mol-geo/util/location-iterator'; import { PickingId } from '../../../../mol-geo/geometry/picking'; -import { StructureGroup } from '../../../structure/units-visual'; -import { getResidueLoci } from './common'; +import { getResidueLoci, StructureGroup } from './common'; export * from './polymer/backbone'; export * from './polymer/gap-iterator';