/** * Create a depiction generator that will render atom labels using the specified AWT font. * * @param font the font to use to display */ public DepictionGenerator(Font font) { gens.add(new BasicSceneGenerator()); gens.add(new StandardGenerator(this.font = font)); for (IGenerator<IAtomContainer> gen : gens) { for (IGeneratorParameter<?> param : gen.getParameters()) { params.put(param.getClass(), param); } } for (IGeneratorParameter<?> param : new RendererModel().getRenderingParameters()) { params.put(param.getClass(), param); } // default margin and separation is automatic // since it depends on raster (px) vs vector (mm) setParam(BasicSceneGenerator.Margin.class, AUTOMATIC); setParam(RendererModel.Padding.class, AUTOMATIC); }
/** Create a depiction generator using the standard sans-serif system font. */ public DepictionGenerator() { this(new Font(getDefaultOsFont(), Font.PLAIN, 13)); setParam(BasicSceneGenerator.BondLength.class, 26.1d); setParam(StandardGenerator.HashSpacing.class, 26 / 8d); setParam(StandardGenerator.WaveSpacing.class, 26 / 8d); }
/** * Low-level option method to set a rendering model parameter. * * @param key option key * @param value option value * @param <T> option key type * @param <U> option value type * @return new generator for method chaining */ public <T extends IGeneratorParameter<S>, S, U extends S> DepictionGenerator withParam( Class<T> key, U value) { DepictionGenerator copy = new DepictionGenerator(this); copy.setParam(key, value); return copy; }