class ReactionBoxGenerator implements IGenerator<IReaction> {

    @Override
    public IRenderingElement generate(IReaction reaction, RendererModel model) {
        if (!model.getParameter(ShowReactionBoxes.class).getValue()) return null;
        double separation = model.getParameter(BondLength.class).getValue()
                / model.getParameter(Scale.class).getValue();
        Rectangle2D totalBounds = BoundsCalculator.calculateBounds(reaction);
        if (totalBounds == null) return null;

        ElementGroup diagram = new ElementGroup();
        Color foregroundColor = model.getParameter(BasicSceneGenerator.ForegroundColor.class).getValue();
        diagram.add(new RectangleElement(totalBounds.getMinX() - separation, totalBounds.getMinY() - separation,
                totalBounds.getMaxX() + separation, totalBounds.getMaxY() + separation, foregroundColor));
        if (reaction.getID() != null) {
            diagram.add(new TextElement((totalBounds.getMinX() + totalBounds.getMaxX()) / 2, totalBounds.getMinY()
                    - separation, reaction.getID(), foregroundColor));
        }
        return diagram;
    }

}