BasicBondGenerator implements IGenerator<IAtomContainer> { @Override public IRenderingElement generate(IAtomContainer container, RendererModel model) { ElementGroup group = new ElementGroup(); this.ringSet = this.getRingSet(container); ringSet.sortAtomContainers(new AtomContainerComparatorBy2DCenter()); for (IBond bond : container.bonds()) { group.add(MarkedElement.markupBond(this.generate(bond, model), bond)); } return group; } BasicBondGenerator(); void setOverrideColor(Color color); void setOverrideBondWidth(double bondWidth); Color getColorForBond(IBond bond, RendererModel model); double getWidthForBond(IBond bond, RendererModel model); @Override IRenderingElement generate(IAtomContainer container, RendererModel model); IRenderingElement generate(IBond currentBond, RendererModel model); IRenderingElement generateBondElement(IBond bond, RendererModel model); IRenderingElement generateBondElement(IBond bond, IBond.Order type, RendererModel model); IRenderingElement generateRingElements(IBond bond, IRing ring, RendererModel model); LineElement generateInnerElement(IBond bond, IRing ring, RendererModel model); IRenderingElement generateBond(IBond bond, RendererModel model); @Override List<IGeneratorParameter<?>> getParameters();  }
@Test public void testSingleAtom() { IAtomContainer singleAtom = makeSingleAtom(); IRenderingElement root = generator.generate(singleAtom, model); List<IRenderingElement> elements = elementUtil.getAllSimpleElements(root); Assert.assertEquals(0, elements.size()); }
@Test public void testSingleBond() { IAtomContainer container = makeSingleBond(); IRenderingElement root = generator.generate(container, model); List<IRenderingElement> elements = elementUtil.getAllSimpleElements(root); Assert.assertEquals(1, elements.size()); LineElement line = (LineElement) elements.get(0); Assert.assertNotSame(0, AbstractGeneratorTest.length(line)); }
@Test public void testSquare() { IAtomContainer square = makeSquare(); IRenderingElement root = generator.generate(square, model); List<IRenderingElement> elements = elementUtil.getAllSimpleElements(root); Assert.assertEquals(4, elements.size()); Assert.assertEquals(new Point2d(0, 0), center(elements)); }