Browse Source

refactored repr.mark

Alexander Rose 6 years ago
parent
commit
1f2631ffd6
24 changed files with 80 additions and 64 deletions
  1. 2 2
      src/mol-model-props/rcsb/representations/assembly-symmetry-axes.ts
  2. 33 17
      src/mol-repr/shape/representation.ts
  3. 3 3
      src/mol-repr/structure/complex-visual.ts
  4. 3 3
      src/mol-repr/structure/units-visual.ts
  5. 2 2
      src/mol-repr/structure/visual/carbohydrate-link-cylinder.ts
  6. 3 3
      src/mol-repr/structure/visual/carbohydrate-symbol-mesh.ts
  7. 3 3
      src/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.ts
  8. 2 2
      src/mol-repr/structure/visual/cross-link-restraint-cylinder.ts
  9. 2 2
      src/mol-repr/structure/visual/element-point.ts
  10. 3 3
      src/mol-repr/structure/visual/element-sphere.ts
  11. 1 1
      src/mol-repr/structure/visual/gaussian-density-point.ts
  12. 1 1
      src/mol-repr/structure/visual/gaussian-density-volume.ts
  13. 2 2
      src/mol-repr/structure/visual/gaussian-surface-mesh.ts
  14. 2 2
      src/mol-repr/structure/visual/gaussian-surface-wireframe.ts
  15. 2 2
      src/mol-repr/structure/visual/inter-unit-link-cylinder.ts
  16. 2 2
      src/mol-repr/structure/visual/intra-unit-link-cylinder.ts
  17. 2 2
      src/mol-repr/structure/visual/nucleotide-block-mesh.ts
  18. 2 2
      src/mol-repr/structure/visual/polymer-backbone-cylinder.ts
  19. 2 2
      src/mol-repr/structure/visual/polymer-direction-wedge.ts
  20. 2 2
      src/mol-repr/structure/visual/polymer-gap-cylinder.ts
  21. 2 2
      src/mol-repr/structure/visual/polymer-trace-mesh.ts
  22. 1 1
      src/mol-repr/structure/visual/util/element.ts
  23. 1 1
      src/mol-repr/structure/visual/util/nucleotide.ts
  24. 2 2
      src/mol-repr/structure/visual/util/polymer.ts

+ 2 - 2
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])

+ 33 - 17
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

+ 3 - 3
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)

+ 3 - 3
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)

+ 2 - 2
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

+ 3 - 3
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)) {

+ 3 - 3
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

+ 2 - 2
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

+ 2 - 2
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>) => {
 
         }

+ 3 - 3
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 ||

+ 1 - 1
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

+ 1 - 1
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

+ 2 - 2
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

+ 2 - 2
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

+ 2 - 2
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

+ 2 - 2
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

+ 2 - 2
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 ||

+ 2 - 2
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 ||

+ 2 - 2
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

+ 2 - 2
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 ||

+ 2 - 2
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 ||

+ 1 - 1
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

+ 1 - 1
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

+ 2 - 2
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