diff --git a/src/mol-model-props/rcsb/representations/assembly-symmetry-axes.ts b/src/mol-model-props/rcsb/representations/assembly-symmetry-axes.ts index a949d4dfc2c6b72672ea3941226e07b13ed73b91..09abfebeb49ec7b35be09744fa09ef1c202cbc30 100644 --- a/src/mol-model-props/rcsb/representations/assembly-symmetry-axes.ts +++ b/src/mol-model-props/rcsb/representations/assembly-symmetry-axes.ts @@ -65,7 +65,7 @@ export function AssemblySymmetryAxesVisual(): ComplexVisual<AssemblySymmetryAxes createGeometry: createAssemblySymmetryAxesMesh, createLocationIterator, getLoci, - mark, + eachLocation: eachAxisLocation, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<AssemblySymmetryAxesParams>, currentProps: PD.Values<AssemblySymmetryAxesParams>) => { state.createGeometry = ( newProps.sizeFactor !== currentProps.sizeFactor || @@ -93,7 +93,7 @@ function getLoci(pickingId: PickingId, structure: Structure, id: number) { return EmptyLoci } -function mark(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) { +function eachAxisLocation(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) { let changed = false if (!isDataLoci(loci) || loci.tag !== 'axes') return false const assemblySymmetry = AssemblySymmetry.get(structure.models[0]) diff --git a/src/mol-repr/shape/representation.ts b/src/mol-repr/shape/representation.ts index 7083810e3bc1d5a342f646b6fb6a77b3e5be1e87..7128c985b9de8b9a96533e21a95ca1eced49ecb7 100644 --- a/src/mol-repr/shape/representation.ts +++ b/src/mol-repr/shape/representation.ts @@ -169,24 +169,19 @@ export function ShapeRepresentation<D, G extends Geometry, P extends Geometry.Pa mark(loci: Loci, action: MarkerAction) { if (!_renderObject) return false const { tMarker } = _renderObject.values + const { groupCount, instanceCount } = locationIt + + function apply(interval: Interval) { + const start = Interval.start(interval) + const end = Interval.end(interval) + return applyMarkerAction(tMarker.ref.value.array, start, end, action) + } + let changed = false - const { groupCount, count } = locationIt - if (isEveryLoci(loci)) { - if (applyMarkerAction(tMarker.ref.value.array, 0, count, action)) changed = true - } else if (Shape.isLoci(loci)) { - const { instance, groups } = loci - for (const g of groups) { - if (Interval.is(g.ids)) { - const start = instance * groupCount + Interval.start(g.ids) - const end = instance * groupCount + Interval.end(g.ids) - if (applyMarkerAction(tMarker.ref.value.array, start, end, action)) changed = true - } else { - for (let i = 0, _i = g.ids.length; i < _i; i++) { - const idx = instance * groupCount + g.ids[i]; - if (applyMarkerAction(tMarker.ref.value.array, idx, idx + 1, action)) changed = true - } - } - } + if (isEveryLoci(loci) || (Shape.isLoci(loci) && loci.shape === _shape)) { + changed = apply(Interval.ofBounds(0, groupCount * instanceCount)) + } else { + changed = eachShapeLocation(loci, _shape, apply) } if (changed) { ValueCell.update(tMarker, tMarker.ref.value) @@ -221,6 +216,27 @@ function createShapeTransform(transforms: Mat4[], transformData?: TransformData) return createTransform(transformArray, transforms.length, transformData) } +function eachShapeLocation(loci: Loci, shape: Shape, apply: (interval: Interval) => boolean) { + if (!Shape.isLoci(loci)) return false + if (loci.shape !== shape) return false + let changed = false + const { groupCount } = shape + const { instance, groups } = loci + for (const g of groups) { + if (Interval.is(g.ids)) { + const start = instance * groupCount + Interval.start(g.ids) + const end = instance * groupCount + Interval.end(g.ids) + if (apply(Interval.ofBounds(start, end))) changed = true + } else { + for (let i = 0, _i = g.ids.length; i < _i; i++) { + const idx = instance * groupCount + g.ids[i]; + if (apply(Interval.ofSingleton(idx))) changed = true + } + } + } + return changed +} + export namespace ShapeGroupIterator { export function fromShape(shape: Shape): LocationIterator { const instanceCount = shape.transforms.length diff --git a/src/mol-repr/structure/complex-visual.ts b/src/mol-repr/structure/complex-visual.ts index 833e2126cd776b35f796fef7b61651af01cab61f..c58d824cd18354050d8ab285e6fa46def6146728 100644 --- a/src/mol-repr/structure/complex-visual.ts +++ b/src/mol-repr/structure/complex-visual.ts @@ -50,7 +50,7 @@ interface ComplexVisualBuilder<P extends ComplexParams, G extends Geometry> { createGeometry(ctx: VisualContext, structure: Structure, theme: Theme, props: PD.Values<P>, geometry?: G): Promise<G> | G createLocationIterator(structure: Structure): LocationIterator getLoci(pickingId: PickingId, structure: Structure, id: number): Loci - mark(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean): boolean, + eachLocation(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean): boolean, setUpdateState(state: VisualUpdateState, newProps: PD.Values<P>, currentProps: PD.Values<P>, newTheme: Theme, currentTheme: Theme): void } @@ -59,7 +59,7 @@ interface ComplexVisualGeometryBuilder<P extends UnitsParams, G extends Geometry } export function ComplexVisual<G extends Geometry, P extends ComplexParams & Geometry.Params<G>>(builder: ComplexVisualGeometryBuilder<P, G>): ComplexVisual<P> { - const { defaultProps, createGeometry, createLocationIterator, getLoci, mark, setUpdateState } = builder + const { defaultProps, createGeometry, createLocationIterator, getLoci, eachLocation, setUpdateState } = builder const { updateValues, updateBoundingSphere, updateRenderableState } = builder.geometryUtils const updateState = VisualUpdateState.create() @@ -187,7 +187,7 @@ export function ComplexVisual<G extends Geometry, P extends ComplexParams & Geom if (isEveryLoci(loci) || (Structure.isLoci(loci) && loci.structure === currentStructure)) { changed = apply(Interval.ofBounds(0, groupCount * instanceCount)) } else { - changed = mark(loci, currentStructure, apply) + changed = eachLocation(loci, currentStructure, apply) } if (changed) { ValueCell.update(tMarker, tMarker.ref.value) diff --git a/src/mol-repr/structure/units-visual.ts b/src/mol-repr/structure/units-visual.ts index 074597241f3df1374ef19d1bb16e540299ef1f4a..b036046bd5c32f6600874dc44254ff37238e9418 100644 --- a/src/mol-repr/structure/units-visual.ts +++ b/src/mol-repr/structure/units-visual.ts @@ -49,7 +49,7 @@ interface UnitsVisualBuilder<P extends UnitsParams, G extends Geometry> { createGeometry(ctx: VisualContext, unit: Unit, structure: Structure, theme: Theme, props: PD.Values<P>, geometry?: G): Promise<G> | G createLocationIterator(group: Unit.SymmetryGroup): LocationIterator getLoci(pickingId: PickingId, structureGroup: StructureGroup, id: number): Loci - mark(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean): boolean + eachLocation(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean): boolean setUpdateState(state: VisualUpdateState, newProps: PD.Values<P>, currentProps: PD.Values<P>, newTheme: Theme, currentTheme: Theme): void } @@ -58,7 +58,7 @@ interface UnitsVisualGeometryBuilder<P extends UnitsParams, G extends Geometry> } export function UnitsVisual<G extends Geometry, P extends UnitsParams & Geometry.Params<G>>(builder: UnitsVisualGeometryBuilder<P, G>): UnitsVisual<P> { - const { defaultProps, createGeometry, createLocationIterator, getLoci, mark, setUpdateState } = builder + const { defaultProps, createGeometry, createLocationIterator, getLoci, eachLocation, setUpdateState } = builder const { createEmpty: createEmptyGeometry, updateValues, updateBoundingSphere, updateRenderableState } = builder.geometryUtils const updateState = VisualUpdateState.create() @@ -233,7 +233,7 @@ export function UnitsVisual<G extends Geometry, P extends UnitsParams & Geometry if (isEveryLoci(loci) || (Structure.isLoci(loci) && loci.structure === currentStructureGroup.structure)) { changed = apply(Interval.ofBounds(0, groupCount * instanceCount)) } else { - changed = mark(loci, currentStructureGroup, apply) + changed = eachLocation(loci, currentStructureGroup, apply) } if (changed) { ValueCell.update(tMarker, tMarker.ref.value) diff --git a/src/mol-repr/structure/visual/carbohydrate-link-cylinder.ts b/src/mol-repr/structure/visual/carbohydrate-link-cylinder.ts index e9c9cfb4aecff654415755b60b5240fe371c39d1..431faff76935be1eed3556790fb580029fbb4dfc 100644 --- a/src/mol-repr/structure/visual/carbohydrate-link-cylinder.ts +++ b/src/mol-repr/structure/visual/carbohydrate-link-cylinder.ts @@ -61,7 +61,7 @@ export function CarbohydrateLinkVisual(): ComplexVisual<CarbohydrateLinkParams> createGeometry: createCarbohydrateLinkCylinderMesh, createLocationIterator: CarbohydrateLinkIterator, getLoci: getLinkLoci, - mark: markLink, + eachLocation: eachCarbohydrateLink, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<CarbohydrateLinkParams>, currentProps: PD.Values<CarbohydrateLinkParams>) => { state.createGeometry = ( newProps.linkSizeFactor !== currentProps.linkSizeFactor || @@ -116,7 +116,7 @@ function getLinkLoci(pickingId: PickingId, structure: Structure, id: number) { return EmptyLoci } -function markLink(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) { +function eachCarbohydrateLink(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) { let changed = false if (Link.isLoci(loci)) { if (loci.structure !== structure) return false diff --git a/src/mol-repr/structure/visual/carbohydrate-symbol-mesh.ts b/src/mol-repr/structure/visual/carbohydrate-symbol-mesh.ts index e0df24ab33d18aed5bf4c6ae9f823ff656618be8..2650b94056b834c028ff8b68d4d9c9195d76ccfb 100644 --- a/src/mol-repr/structure/visual/carbohydrate-symbol-mesh.ts +++ b/src/mol-repr/structure/visual/carbohydrate-symbol-mesh.ts @@ -154,7 +154,7 @@ export function CarbohydrateSymbolVisual(): ComplexVisual<CarbohydrateSymbolPara createGeometry: createCarbohydrateSymbolMesh, createLocationIterator: CarbohydrateElementIterator, getLoci: getCarbohydrateLoci, - mark: markCarbohydrate, + eachLocation: eachCarbohydrate, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<CarbohydrateSymbolParams>, currentProps: PD.Values<CarbohydrateSymbolParams>) => { state.createGeometry = ( newProps.sizeFactor !== currentProps.sizeFactor || @@ -191,8 +191,8 @@ function getCarbohydrateLoci(pickingId: PickingId, structure: Structure, id: num return EmptyLoci } -/** Mark a carbohydrate (usually a monosaccharide) when all its residue's elements are in a loci. */ -function markCarbohydrate(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) { +/** For each carbohydrate (usually a monosaccharide) when all its residue's elements are in a loci. */ +function eachCarbohydrate(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) { const { getElementIndex, getAnomericCarbon } = structure.carbohydrates let changed = false if (StructureElement.isLoci(loci)) { diff --git a/src/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.ts b/src/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.ts index 69368d4ca87dc326cf110bb2a7e7ec7fc9bceaa9..ae52c083ab489262a5147f9ad599f23f1c4357b9 100644 --- a/src/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.ts +++ b/src/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.ts @@ -71,7 +71,7 @@ export function CarbohydrateTerminalLinkVisual(): ComplexVisual<CarbohydrateTerm createGeometry: createCarbohydrateTerminalLinkCylinderMesh, createLocationIterator: CarbohydrateTerminalLinkIterator, getLoci: getTerminalLinkLoci, - mark: markTerminalLink, + eachLocation: eachTerminalLink, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<CarbohydrateTerminalLinkParams>, currentProps: PD.Values<CarbohydrateTerminalLinkParams>) => { state.createGeometry = ( newProps.linkSizeFactor !== currentProps.linkSizeFactor || @@ -128,8 +128,8 @@ function getTerminalLinkLoci(pickingId: PickingId, structure: Structure, id: num return EmptyLoci } -// TODO mark link when both of the link elements are in a StructureElement.Loci -function markTerminalLink(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) { +// TODO for each link when both of the link elements are in a StructureElement.Loci +function eachTerminalLink(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) { const { getTerminalLinkIndex } = structure.carbohydrates let changed = false diff --git a/src/mol-repr/structure/visual/cross-link-restraint-cylinder.ts b/src/mol-repr/structure/visual/cross-link-restraint-cylinder.ts index 5c5c8d388a3417dcb0d09687c6f3481d24325664..1eb290b62d314c64a92178697b9b8e6c971a869f 100644 --- a/src/mol-repr/structure/visual/cross-link-restraint-cylinder.ts +++ b/src/mol-repr/structure/visual/cross-link-restraint-cylinder.ts @@ -64,7 +64,7 @@ export function CrossLinkRestraintVisual(): ComplexVisual<CrossLinkRestraintPara createGeometry: createCrossLinkRestraintCylinderMesh, createLocationIterator: CrossLinkRestraintIterator, getLoci: getLinkLoci, - mark: markLink, + eachLocation: eachCrossLink, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<CrossLinkRestraintParams>, currentProps: PD.Values<CrossLinkRestraintParams>) => { state.createGeometry = ( newProps.sizeFactor !== currentProps.sizeFactor || @@ -104,7 +104,7 @@ function getLinkLoci(pickingId: PickingId, structure: Structure, id: number) { return EmptyLoci } -function markLink(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) { +function eachCrossLink(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) { const crossLinks = structure.crossLinkRestraints let changed = false diff --git a/src/mol-repr/structure/visual/element-point.ts b/src/mol-repr/structure/visual/element-point.ts index 73c77715bc4a31d5039ea78476d1d42aa5b57f22..64db953cbb4402571c10e3db99a2cf44d8109da8 100644 --- a/src/mol-repr/structure/visual/element-point.ts +++ b/src/mol-repr/structure/visual/element-point.ts @@ -7,7 +7,7 @@ import { Unit, Structure } from 'mol-model/structure'; import { UnitsVisual } from '../representation'; import { VisualUpdateState } from '../../util'; -import { getElementLoci, StructureElementIterator, markElement } from './util/element'; +import { getElementLoci, StructureElementIterator, eachElement } from './util/element'; import { Vec3 } from 'mol-math/linear-algebra'; import { UnitsPointsVisual, UnitsPointsParams } from '../units-visual'; import { ParamDefinition as PD } from 'mol-util/param-definition'; @@ -48,7 +48,7 @@ export function ElementPointVisual(): UnitsVisual<ElementPointParams> { createGeometry: createElementPoint, createLocationIterator: StructureElementIterator.fromGroup, getLoci: getElementLoci, - mark: markElement, + eachLocation: eachElement, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<ElementPointParams>, currentProps: PD.Values<ElementPointParams>) => { } diff --git a/src/mol-repr/structure/visual/element-sphere.ts b/src/mol-repr/structure/visual/element-sphere.ts index 4608121fc85792e2a9036afd7339f6774fb64491..afbe90fbb144fe2a3dad2aff1817781fa19df137 100644 --- a/src/mol-repr/structure/visual/element-sphere.ts +++ b/src/mol-repr/structure/visual/element-sphere.ts @@ -7,7 +7,7 @@ import { UnitsVisual } from '../representation'; import { VisualUpdateState } from '../../util'; -import { createElementSphereMesh, markElement, getElementLoci, StructureElementIterator, createElementSphereImpostor } from './util/element'; +import { createElementSphereMesh, eachElement, getElementLoci, StructureElementIterator, createElementSphereImpostor } from './util/element'; import { UnitsMeshVisual, UnitsMeshParams, UnitsSpheresVisual, UnitsSpheresParams } from '../units-visual'; import { ParamDefinition as PD } from 'mol-util/param-definition'; import { WebGLContext } from 'mol-gl/webgl/context'; @@ -30,7 +30,7 @@ export function ElementSphereImpostorVisual(): UnitsVisual<ElementSphereParams> createGeometry: createElementSphereImpostor, createLocationIterator: StructureElementIterator.fromGroup, getLoci: getElementLoci, - mark: markElement, + eachLocation: eachElement, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<ElementSphereParams>, currentProps: PD.Values<ElementSphereParams>) => { } @@ -43,7 +43,7 @@ export function ElementSphereMeshVisual(): UnitsVisual<ElementSphereParams> { createGeometry: createElementSphereMesh, createLocationIterator: StructureElementIterator.fromGroup, getLoci: getElementLoci, - mark: markElement, + eachLocation: eachElement, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<ElementSphereParams>, currentProps: PD.Values<ElementSphereParams>) => { state.createGeometry = ( newProps.sizeFactor !== currentProps.sizeFactor || diff --git a/src/mol-repr/structure/visual/gaussian-density-point.ts b/src/mol-repr/structure/visual/gaussian-density-point.ts index 3e260df8c0575e516e67895d1284aad3b4c66474..beef6aae62dbbf963c6d2b9460309e24664d48d4 100644 --- a/src/mol-repr/structure/visual/gaussian-density-point.ts +++ b/src/mol-repr/structure/visual/gaussian-density-point.ts @@ -61,7 +61,7 @@ export function GaussianDensityPointVisual(): UnitsVisual<GaussianDensityPointPa createGeometry: createGaussianDensityPoint, createLocationIterator: StructureElementIterator.fromGroup, getLoci: () => EmptyLoci, - mark: () => false, + eachLocation: () => false, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<GaussianDensityPointParams>, currentProps: PD.Values<GaussianDensityPointParams>) => { if (newProps.resolution !== currentProps.resolution) state.createGeometry = true if (newProps.radiusOffset !== currentProps.radiusOffset) state.createGeometry = true diff --git a/src/mol-repr/structure/visual/gaussian-density-volume.ts b/src/mol-repr/structure/visual/gaussian-density-volume.ts index 51b8b809ec3fbcb08d8a81686dd256af69c4c55a..7aac5a7b9aafbbe775f4769c0051f77c36e00152 100644 --- a/src/mol-repr/structure/visual/gaussian-density-volume.ts +++ b/src/mol-repr/structure/visual/gaussian-density-volume.ts @@ -40,7 +40,7 @@ export function GaussianDensityVolumeVisual(): ComplexVisual<GaussianDensityVolu createGeometry: createGaussianDensityVolume, createLocationIterator: (structure: Structure) => LocationIterator(structure.elementCount, 1, () => NullLocation), getLoci: () => EmptyLoci, // TODO - mark: () => false, // TODO + eachLocation: () => false, // TODO setUpdateState: (state: VisualUpdateState, newProps: PD.Values<GaussianDensityVolumeParams>, currentProps: PD.Values<GaussianDensityVolumeParams>) => { if (newProps.resolution !== currentProps.resolution) state.createGeometry = true if (newProps.radiusOffset !== currentProps.radiusOffset) state.createGeometry = true diff --git a/src/mol-repr/structure/visual/gaussian-surface-mesh.ts b/src/mol-repr/structure/visual/gaussian-surface-mesh.ts index 9dc645bbc1dba06ca9c702f06d60eeda2a0d72a3..166252a81a076d7e1ccd496890c2c63496264b8b 100644 --- a/src/mol-repr/structure/visual/gaussian-surface-mesh.ts +++ b/src/mol-repr/structure/visual/gaussian-surface-mesh.ts @@ -8,7 +8,7 @@ import { Unit, Structure } from 'mol-model/structure'; import { UnitsVisual } from '../representation'; import { VisualUpdateState } from '../../util'; import { UnitsMeshVisual, UnitsMeshParams } from '../units-visual'; -import { StructureElementIterator, getElementLoci, markElement } from './util/element'; +import { StructureElementIterator, getElementLoci, eachElement } from './util/element'; import { ParamDefinition as PD } from 'mol-util/param-definition'; import { Mesh } from 'mol-geo/geometry/mesh/mesh'; import { computeMarchingCubesMesh } from 'mol-geo/util/marching-cubes/algorithm'; @@ -46,7 +46,7 @@ export function GaussianSurfaceVisual(): UnitsVisual<GaussianSurfaceParams> { createGeometry: createGaussianSurfaceMesh, createLocationIterator: StructureElementIterator.fromGroup, getLoci: getElementLoci, - mark: markElement, + eachLocation: eachElement, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<GaussianSurfaceParams>, currentProps: PD.Values<GaussianSurfaceParams>) => { if (newProps.resolution !== currentProps.resolution) state.createGeometry = true if (newProps.radiusOffset !== currentProps.radiusOffset) state.createGeometry = true diff --git a/src/mol-repr/structure/visual/gaussian-surface-wireframe.ts b/src/mol-repr/structure/visual/gaussian-surface-wireframe.ts index a292ff3e5670aa68e66816cac1dec5a28e1eb80b..5efe3f47bf6395431987a0717b27e6f7d4558b38 100644 --- a/src/mol-repr/structure/visual/gaussian-surface-wireframe.ts +++ b/src/mol-repr/structure/visual/gaussian-surface-wireframe.ts @@ -8,7 +8,7 @@ import { Unit, Structure } from 'mol-model/structure'; import { UnitsVisual } from '../representation'; import { VisualUpdateState } from '../../util'; import { UnitsLinesVisual, UnitsLinesParams } from '../units-visual'; -import { StructureElementIterator, getElementLoci, markElement } from './util/element'; +import { StructureElementIterator, getElementLoci, eachElement } from './util/element'; import { ParamDefinition as PD } from 'mol-util/param-definition'; import { Lines } from 'mol-geo/geometry/lines/lines'; import { computeMarchingCubesLines } from 'mol-geo/util/marching-cubes/algorithm'; @@ -45,7 +45,7 @@ export function GaussianWireframeVisual(): UnitsVisual<GaussianWireframeParams> createGeometry: createGaussianWireframe, createLocationIterator: StructureElementIterator.fromGroup, getLoci: getElementLoci, - mark: markElement, + eachLocation: eachElement, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<GaussianWireframeParams>, currentProps: PD.Values<GaussianWireframeParams>) => { if (newProps.resolution !== currentProps.resolution) state.createGeometry = true if (newProps.radiusOffset !== currentProps.radiusOffset) state.createGeometry = true diff --git a/src/mol-repr/structure/visual/inter-unit-link-cylinder.ts b/src/mol-repr/structure/visual/inter-unit-link-cylinder.ts index b16a312d3ef7f29ccd74a2a61242ac4cac050307..7d10b67712f904dbdf72feb719d6bac2e00b65b8 100644 --- a/src/mol-repr/structure/visual/inter-unit-link-cylinder.ts +++ b/src/mol-repr/structure/visual/inter-unit-link-cylinder.ts @@ -64,7 +64,7 @@ export function InterUnitLinkVisual(): ComplexVisual<InterUnitLinkParams> { createGeometry: createInterUnitLinkCylinderMesh, createLocationIterator: LinkIterator.fromStructure, getLoci: getLinkLoci, - mark: markLink, + eachLocation: eachLink, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<InterUnitLinkParams>, currentProps: PD.Values<InterUnitLinkParams>) => { state.createGeometry = ( newProps.sizeFactor !== currentProps.sizeFactor || @@ -95,7 +95,7 @@ function getLinkLoci(pickingId: PickingId, structure: Structure, id: number) { return EmptyLoci } -function markLink(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) { +function eachLink(loci: Loci, structure: Structure, apply: (interval: Interval) => boolean) { let changed = false if (Link.isLoci(loci)) { if (loci.structure !== structure) return false diff --git a/src/mol-repr/structure/visual/intra-unit-link-cylinder.ts b/src/mol-repr/structure/visual/intra-unit-link-cylinder.ts index fad35df529db12baacb5b1ac74b2c5b74788e6ff..d04f8d58f059bf6e8cc70b05e0a86b5b96252336 100644 --- a/src/mol-repr/structure/visual/intra-unit-link-cylinder.ts +++ b/src/mol-repr/structure/visual/intra-unit-link-cylinder.ts @@ -78,7 +78,7 @@ export function IntraUnitLinkVisual(): UnitsVisual<IntraUnitLinkParams> { createGeometry: createIntraUnitLinkCylinderMesh, createLocationIterator: LinkIterator.fromGroup, getLoci: getLinkLoci, - mark: markLink, + eachLocation: eachLink, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<IntraUnitLinkParams>, currentProps: PD.Values<IntraUnitLinkParams>) => { state.createGeometry = ( newProps.sizeFactor !== currentProps.sizeFactor || @@ -112,7 +112,7 @@ function getLinkLoci(pickingId: PickingId, structureGroup: StructureGroup, id: n return EmptyLoci } -function markLink(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean) { +function eachLink(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean) { let changed = false if (Link.isLoci(loci)) { const { structure, group } = structureGroup diff --git a/src/mol-repr/structure/visual/nucleotide-block-mesh.ts b/src/mol-repr/structure/visual/nucleotide-block-mesh.ts index 6e638cf3ed2f6a5ead2fe6dbf404408a013c73a3..78fa5aa2f974b63e88cac56235da5aa3a09a66d4 100644 --- a/src/mol-repr/structure/visual/nucleotide-block-mesh.ts +++ b/src/mol-repr/structure/visual/nucleotide-block-mesh.ts @@ -10,7 +10,7 @@ import { Vec3, Mat4 } from 'mol-math/linear-algebra'; import { Segmentation } from 'mol-data/int'; import { isNucleic, isPurinBase, isPyrimidineBase } from 'mol-model/structure/model/types'; import { UnitsMeshVisual, UnitsMeshParams } from '../units-visual'; -import { NucleotideLocationIterator, markNucleotideElement, getNucleotideElementLoci } from './util/nucleotide'; +import { NucleotideLocationIterator, eachNucleotideElement, getNucleotideElementLoci } from './util/nucleotide'; import { ParamDefinition as PD } from 'mol-util/param-definition'; import { Box } from 'mol-geo/primitive/box'; import { Mesh } from 'mol-geo/geometry/mesh/mesh'; @@ -134,7 +134,7 @@ export function NucleotideBlockVisual(): UnitsVisual<NucleotideBlockParams> { createGeometry: createNucleotideBlockMesh, createLocationIterator: NucleotideLocationIterator.fromGroup, getLoci: getNucleotideElementLoci, - mark: markNucleotideElement, + eachLocation: eachNucleotideElement, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<NucleotideBlockParams>, currentProps: PD.Values<NucleotideBlockParams>) => { state.createGeometry = ( newProps.sizeFactor !== currentProps.sizeFactor || diff --git a/src/mol-repr/structure/visual/polymer-backbone-cylinder.ts b/src/mol-repr/structure/visual/polymer-backbone-cylinder.ts index 60e8ba403f1fa0433a258b7f53724a1221ce09e6..8584245222c4ebd57889f01f13c254ab3790bf40 100644 --- a/src/mol-repr/structure/visual/polymer-backbone-cylinder.ts +++ b/src/mol-repr/structure/visual/polymer-backbone-cylinder.ts @@ -8,7 +8,7 @@ import { Unit, Structure } from 'mol-model/structure'; import { UnitsVisual } from '../representation'; import { VisualUpdateState } from '../../util'; import { PolymerBackboneIterator } from './util/polymer'; -import { getElementLoci, markElement, StructureElementIterator } from './util/element'; +import { getElementLoci, eachElement, StructureElementIterator } from './util/element'; import { Vec3 } from 'mol-math/linear-algebra'; import { UnitsMeshVisual, UnitsMeshParams } from '../units-visual'; import { OrderedSet } from 'mol-data/int'; @@ -74,7 +74,7 @@ export function PolymerBackboneVisual(): UnitsVisual<PolymerBackboneParams> { // TODO create a specialized location iterator createLocationIterator: StructureElementIterator.fromGroup, getLoci: getElementLoci, - mark: markElement, + eachLocation: eachElement, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<PolymerBackboneParams>, currentProps: PD.Values<PolymerBackboneParams>) => { state.createGeometry = ( newProps.sizeFactor !== currentProps.sizeFactor || diff --git a/src/mol-repr/structure/visual/polymer-direction-wedge.ts b/src/mol-repr/structure/visual/polymer-direction-wedge.ts index d94e90efbc3714750b118292adc7c27b7cc5921a..ab3e037548ced5b766f2c8b630fd14b14697310d 100644 --- a/src/mol-repr/structure/visual/polymer-direction-wedge.ts +++ b/src/mol-repr/structure/visual/polymer-direction-wedge.ts @@ -6,7 +6,7 @@ import { Unit, Structure } from 'mol-model/structure'; import { UnitsVisual } from '../representation'; -import { PolymerTraceIterator, createCurveSegmentState, interpolateCurveSegment, PolymerLocationIterator, getPolymerElementLoci, markPolymerElement } from './util/polymer'; +import { PolymerTraceIterator, createCurveSegmentState, interpolateCurveSegment, PolymerLocationIterator, getPolymerElementLoci, eachPolymerElement } from './util/polymer'; import { Vec3, Mat4 } from 'mol-math/linear-algebra'; import { SecondaryStructureType, isNucleic } from 'mol-model/structure/model/types'; import { UnitsMeshVisual, UnitsMeshParams } from '../units-visual'; @@ -98,7 +98,7 @@ export function PolymerDirectionVisual(): UnitsVisual<PolymerDirectionParams> { createGeometry: createPolymerDirectionWedgeMesh, createLocationIterator: PolymerLocationIterator.fromGroup, getLoci: getPolymerElementLoci, - mark: markPolymerElement, + eachLocation: eachPolymerElement, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<PolymerDirectionParams>, currentProps: PD.Values<PolymerDirectionParams>) => { state.createGeometry = ( newProps.sizeFactor !== currentProps.sizeFactor diff --git a/src/mol-repr/structure/visual/polymer-gap-cylinder.ts b/src/mol-repr/structure/visual/polymer-gap-cylinder.ts index d2ebb496edcf15f62469ec34e66c00696b02f8b2..dc80fba747b4d4de619b47257899b0efc3ec3a14 100644 --- a/src/mol-repr/structure/visual/polymer-gap-cylinder.ts +++ b/src/mol-repr/structure/visual/polymer-gap-cylinder.ts @@ -7,7 +7,7 @@ import { Unit, Structure } from 'mol-model/structure'; import { UnitsVisual } from '../representation'; import { VisualUpdateState } from '../../util'; -import { PolymerGapIterator, PolymerGapLocationIterator, markPolymerGapElement, getPolymerGapElementLoci } from './util/polymer'; +import { PolymerGapIterator, PolymerGapLocationIterator, eachPolymerGapElement, getPolymerGapElementLoci } from './util/polymer'; import { Vec3 } from 'mol-math/linear-algebra'; import { UnitsMeshVisual, UnitsMeshParams } from '../units-visual'; import { ParamDefinition as PD } from 'mol-util/param-definition'; @@ -91,7 +91,7 @@ export function PolymerGapVisual(): UnitsVisual<PolymerGapParams> { createGeometry: createPolymerGapCylinderMesh, createLocationIterator: PolymerGapLocationIterator.fromGroup, getLoci: getPolymerGapElementLoci, - mark: markPolymerGapElement, + eachLocation: eachPolymerGapElement, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<PolymerGapParams>, currentProps: PD.Values<PolymerGapParams>) => { state.createGeometry = ( newProps.sizeFactor !== currentProps.sizeFactor || diff --git a/src/mol-repr/structure/visual/polymer-trace-mesh.ts b/src/mol-repr/structure/visual/polymer-trace-mesh.ts index c30503dc13f9fd1f226ef01b8a98badd7726769c..dfbd3b6a363862434493f0977d83a5a362ab0b09 100644 --- a/src/mol-repr/structure/visual/polymer-trace-mesh.ts +++ b/src/mol-repr/structure/visual/polymer-trace-mesh.ts @@ -7,7 +7,7 @@ import { Unit, Structure } from 'mol-model/structure'; import { UnitsVisual } from '../representation'; import { VisualUpdateState } from '../../util'; -import { PolymerTraceIterator, createCurveSegmentState, interpolateCurveSegment, PolymerLocationIterator, getPolymerElementLoci, markPolymerElement, interpolateSizes } from './util/polymer'; +import { PolymerTraceIterator, createCurveSegmentState, interpolateCurveSegment, PolymerLocationIterator, getPolymerElementLoci, eachPolymerElement, interpolateSizes } from './util/polymer'; import { SecondaryStructureType, isNucleic } from 'mol-model/structure/model/types'; import { UnitsMeshVisual, UnitsMeshParams } from '../units-visual'; import { ParamDefinition as PD } from 'mol-util/param-definition'; @@ -110,7 +110,7 @@ export function PolymerTraceVisual(): UnitsVisual<PolymerTraceParams> { createGeometry: createPolymerTraceMesh, createLocationIterator: PolymerLocationIterator.fromGroup, getLoci: getPolymerElementLoci, - mark: markPolymerElement, + eachLocation: eachPolymerElement, setUpdateState: (state: VisualUpdateState, newProps: PD.Values<PolymerTraceParams>, currentProps: PD.Values<PolymerTraceParams>) => { state.createGeometry = ( newProps.sizeFactor !== currentProps.sizeFactor || diff --git a/src/mol-repr/structure/visual/util/element.ts b/src/mol-repr/structure/visual/util/element.ts index baab3d964710402313240eeacac172c7b3fe5a5a..37aaff1be3d4037f8b81bb01e6483795ce248d9a 100644 --- a/src/mol-repr/structure/visual/util/element.ts +++ b/src/mol-repr/structure/visual/util/element.ts @@ -68,7 +68,7 @@ export function createElementSphereImpostor(ctx: VisualContext, unit: Unit, stru return builder.getSpheres() } -export function markElement(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean) { +export function eachElement(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean) { let changed = false if (!StructureElement.isLoci(loci)) return false const { structure, group } = structureGroup diff --git a/src/mol-repr/structure/visual/util/nucleotide.ts b/src/mol-repr/structure/visual/util/nucleotide.ts index 44ce2c3e8638cb616ec6aed922d9565e1aed2617..ff5ada0d59f90fe7c5e0445702e1e6ebbfc657f5 100644 --- a/src/mol-repr/structure/visual/util/nucleotide.ts +++ b/src/mol-repr/structure/visual/util/nucleotide.ts @@ -40,7 +40,7 @@ export function getNucleotideElementLoci(pickingId: PickingId, structureGroup: S return EmptyLoci } -export function markNucleotideElement(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean) { +export function eachNucleotideElement(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean) { let changed = false if (!StructureElement.isLoci(loci)) return false const { structure, group } = structureGroup diff --git a/src/mol-repr/structure/visual/util/polymer.ts b/src/mol-repr/structure/visual/util/polymer.ts index 288bf8527c97cf1344c9de45a6eccfacccf7d473..7dd84c2d93ab975b7c64cf988ccde8005407952a 100644 --- a/src/mol-repr/structure/visual/util/polymer.ts +++ b/src/mol-repr/structure/visual/util/polymer.ts @@ -78,7 +78,7 @@ export function getPolymerElementLoci(pickingId: PickingId, structureGroup: Stru } /** Mark a polymer element (e.g. part of a cartoon trace) when all its residue's elements are in a loci. */ -export function markPolymerElement(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean) { +export function eachPolymerElement(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean) { let changed = false if (!StructureElement.isLoci(loci)) return false const { structure, group } = structureGroup @@ -126,7 +126,7 @@ export function getPolymerGapElementLoci(pickingId: PickingId, structureGroup: S return EmptyLoci } -export function markPolymerGapElement(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean) { +export function eachPolymerGapElement(loci: Loci, structureGroup: StructureGroup, apply: (interval: Interval) => boolean) { let changed = false if (!Link.isLoci(loci)) return false const { structure, group } = structureGroup