class ReactionPlusGenerator implements IGenerator<IReaction> {

    @Override
    public IRenderingElement generate(IReaction reaction, RendererModel model) {
        ElementGroup diagram = new ElementGroup();

        Color color = model.getParameter(BasicSceneGenerator.ForegroundColor.class).getValue();
        IAtomContainerSet reactants = reaction.getReactants();

        // only draw + signs when there are more than one reactant
        if (reactants.getAtomContainerCount() > 1) {
            Rectangle2D totalBoundsReactants = BoundsCalculator.calculateBounds(reactants);
            Rectangle2D bounds1 = BoundsCalculator.calculateBounds(reactants.getAtomContainer(0));
            double axis = totalBoundsReactants.getCenterY();
            for (int i = 1; i < reaction.getReactantCount(); i++) {
                Rectangle2D bounds2 = BoundsCalculator.calculateBounds(reactants.getAtomContainer(i));
                diagram.add(makePlus(bounds1, bounds2, axis, color));
                bounds1 = bounds2;
            }
        }

        // only draw + signs when there are more than one products
        IAtomContainerSet products = reaction.getProducts();
        if (products.getAtomContainerCount() > 1) {
            Rectangle2D totalBoundsProducts = BoundsCalculator.calculateBounds(products);
            double axis = totalBoundsProducts.getCenterY();
            Rectangle2D bounds1 = BoundsCalculator.calculateBounds(reactants.getAtomContainer(0));
            for (int i = 1; i < reaction.getProductCount(); i++) {
                Rectangle2D bounds2 = BoundsCalculator.calculateBounds(products.getAtomContainer(i));

                diagram.add(makePlus(bounds1, bounds2, axis, color));
                bounds1 = bounds2;
            }
        }
        return diagram;
    }

}