class AtomNumberGenerator implements IGenerator<IAtomContainer> {

    @Override
    public IRenderingElement generate(IAtomContainer container, RendererModel model) {
        ElementGroup numbers = new ElementGroup();
        if (!model.getParameter(WillDrawAtomNumbers.class).getValue()) return numbers;

        Vector2d offset = new Vector2d(this.offset.getValue().x, -this.offset.getValue().y);
        offset.scale(1 / model.getParameter(Scale.class).getValue());

        int number = 1;
        for (IAtom atom : container.atoms()) {
            Point2d point = new Point2d(atom.getPoint2d());
            point.add(offset);
            numbers.add(new TextElement(point.x, point.y, String.valueOf(number), colorByType.getValue() ? atomColorer
                    .getValue().getAtomColor(atom) : textColor.getValue()));
            number++;
        }
        return numbers;
    }

}