Skip to content
Snippets Groups Projects
Commit f404d232 authored by Alexander Rose's avatar Alexander Rose
Browse files

take include/exclude flags into account when displaying aromatic bonds

- this allows to show aromatic rings only when explicitely given
parent 8b7333b4
No related branches found
No related tags found
No related merge requests found
......@@ -133,7 +133,7 @@ function getInterUnitBondCylinderBuilderProps(structure: Structure, theme: Theme
const o = edges[edgeIndex].props.order;
const f = BitFlags.create(edges[edgeIndex].props.flag);
if (BondType.is(f, BondType.Flag.MetallicCoordination) || BondType.is(f, BondType.Flag.HydrogenBond)) {
// show metall coordinations and hydrogen bonds with dashed cylinders
// show metallic coordinations and hydrogen bonds with dashed cylinders
return LinkStyle.Dashed;
} else if (o === 3) {
return LinkStyle.Triple;
......
......@@ -71,7 +71,7 @@ function createInterUnitBondLines(ctx: VisualContext, structure: Structure, them
const o = edges[edgeIndex].props.order;
const f = BitFlags.create(edges[edgeIndex].props.flag);
if (BondType.is(f, BondType.Flag.MetallicCoordination) || BondType.is(f, BondType.Flag.HydrogenBond)) {
// show metall coordinations and hydrogen bonds with dashed cylinders
// show metallic coordinations and hydrogen bonds with dashed cylinders
return LinkStyle.Dashed;
} else if (o === 3) {
return LinkStyle.Triple;
......
......@@ -16,7 +16,7 @@ import { createLinkCylinderImpostors, createLinkCylinderMesh, LinkBuilderProps,
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';
import { BondCylinderParams, BondIterator, eachIntraBond, getIntraBondLoci, ignoreBondType, makeIntraBondIgnoreTest } from './util/bond';
import { Sphere3D } from '../../../mol-math/geometry';
import { IntAdjacencyGraph } from '../../../mol-math/graph';
import { WebGLContext } from '../../../mol-gl/webgl/context';
......@@ -33,7 +33,11 @@ function getIntraUnitBondCylinderBuilderProps(unit: Unit.Atomic, structure: Stru
const bonds = unit.bonds;
const { edgeCount, a, b, edgeProps, offset } = bonds;
const { order: _order, flags: _flags } = edgeProps;
const { sizeFactor, sizeAspectRatio, adjustCylinderLength, aromaticBonds } = props;
const { sizeFactor, sizeAspectRatio, adjustCylinderLength, aromaticBonds, includeTypes, excludeTypes } = props;
const include = BondType.fromNames(includeTypes);
const exclude = BondType.fromNames(excludeTypes);
const ignoreComputedAromatic = ignoreBondType(include, exclude, BondType.Flag.Computed);
const vRef = Vec3(), delta = Vec3();
const pos = unit.conformation.invariantPosition;
......@@ -123,7 +127,7 @@ function getIntraUnitBondCylinderBuilderProps(unit: Unit.Atomic, structure: Stru
const o = _order[edgeIndex];
const f = _flags[edgeIndex];
if (isBondType(f, BondType.Flag.MetallicCoordination) || isBondType(f, BondType.Flag.HydrogenBond)) {
// show metall coordinations and hydrogen bonds with dashed cylinders
// show metallic coordinations and hydrogen bonds with dashed cylinders
return LinkStyle.Dashed;
} else if (o === 3) {
return LinkStyle.Triple;
......@@ -133,7 +137,7 @@ function getIntraUnitBondCylinderBuilderProps(unit: Unit.Atomic, structure: Stru
const bR = elementAromaticRingIndices.get(bI);
const arCount = (aR && bR) ? arrayIntersectionSize(aR, bR) : 0;
if (arCount || isBondType(f, BondType.Flag.Aromatic)) {
if (isBondType(f, BondType.Flag.Aromatic) || (arCount && !ignoreComputedAromatic)) {
if (arCount === 2) {
return LinkStyle.MirroredAromatic;
} else {
......
......@@ -14,7 +14,7 @@ import { LinkStyle, createLinkLines, LinkBuilderProps } from './util/link';
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';
import { BondIterator, BondLineParams, getIntraBondLoci, eachIntraBond, makeIntraBondIgnoreTest, ignoreBondType } from './util/bond';
import { Sphere3D } from '../../../mol-math/geometry';
import { Lines } from '../../../mol-geo/geometry/lines/lines';
import { IntAdjacencyGraph } from '../../../mol-math/graph';
......@@ -36,10 +36,14 @@ function createIntraUnitBondLines(ctx: VisualContext, unit: Unit, structure: Str
const elements = unit.elements;
const bonds = unit.bonds;
const { edgeCount, a, b, edgeProps, offset } = bonds;
if (!edgeCount) return Lines.createEmpty(lines);
const { order: _order, flags: _flags } = edgeProps;
const { sizeFactor, aromaticBonds } = props;
const { sizeFactor, aromaticBonds, includeTypes, excludeTypes } = props;
if (!edgeCount) return Lines.createEmpty(lines);
const include = BondType.fromNames(includeTypes);
const exclude = BondType.fromNames(excludeTypes);
const ignoreComputedAromatic = ignoreBondType(include, exclude, BondType.Flag.Computed);
const vRef = Vec3();
const pos = unit.conformation.invariantPosition;
......@@ -84,7 +88,7 @@ function createIntraUnitBondLines(ctx: VisualContext, unit: Unit, structure: Str
const o = _order[edgeIndex];
const f = _flags[edgeIndex];
if (isBondType(f, BondType.Flag.MetallicCoordination) || isBondType(f, BondType.Flag.HydrogenBond)) {
// show metall coordinations and hydrogen bonds with dashed cylinders
// show metallic coordinations and hydrogen bonds with dashed cylinders
return LinkStyle.Dashed;
} else if (o === 3) {
return LinkStyle.Triple;
......@@ -94,7 +98,7 @@ function createIntraUnitBondLines(ctx: VisualContext, unit: Unit, structure: Str
const bR = elementAromaticRingIndices.get(bI);
const arCount = (aR && bR) ? arrayIntersectionSize(aR, bR) : 0;
if (arCount || isBondType(f, BondType.Flag.Aromatic)) {
if (isBondType(f, BondType.Flag.Aromatic) || (arCount && !ignoreComputedAromatic)) {
if (arCount === 2) {
return LinkStyle.MirroredAromatic;
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment