Skip to content

Commit 3005b1c

Browse files
committed
Put the smallest rings in a field so we can reuse from the bond generator.
1 parent 8c6dd38 commit 3005b1c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardDonutGenerator.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.openscience.cdk.interfaces.IAtom;
2929
import org.openscience.cdk.interfaces.IAtomContainer;
3030
import org.openscience.cdk.interfaces.IBond;
31-
import org.openscience.cdk.interfaces.IChemObject;
3231
import org.openscience.cdk.interfaces.IRingSet;
3332
import org.openscience.cdk.renderer.RendererModel;
3433
import org.openscience.cdk.renderer.elements.ElementGroup;
@@ -53,6 +52,9 @@ final class StandardDonutGenerator {
5352
private final Set<IBond> bonds = new HashSet<>();
5453
// atoms with delocalised charge
5554
private final Set<IAtom> atoms = new HashSet<>();
55+
// smallest rings through each edge
56+
IRingSet smallest;
57+
5658
private final boolean forceDelocalised;
5759
private final boolean delocalisedDonuts;
5860
private final double dbSpacing;
@@ -91,8 +93,8 @@ IRenderingElement generate() {
9193
if (!delocalisedDonuts)
9294
return null;
9395
ElementGroup group = new ElementGroup();
94-
IRingSet rset = Cycles.edgeShort(mol).toRingSet();
95-
for (IAtomContainer ring : rset.atomContainers()) {
96+
smallest = Cycles.edgeShort(mol).toRingSet();
97+
for (IAtomContainer ring : smallest.atomContainers()) {
9698
if (!canDelocalise(ring))
9799
continue;
98100
for (IBond bond : ring.bonds()) {

0 commit comments

Comments
 (0)