Skip to content

Standard Generator Comparison

John May edited this page Aug 18, 2014 · 13 revisions

A popular defacto style used for depicting structures is 'ACS 1996' (see. Structure_drawing, Wikipedia). This style can be approximated with the follow standard generator configuration.

// 26 pt is also okay
Font font = new Font("Arial", Font.PLAIN, 24);

// note the font manager is not used
AtomContainerRenderer renderer 
  = new AtomContainerRenderer(Arrays.asList(new BasicSceneGenerator(),
                                            new StandardGenerator(font)),
                              new AWTFontManager()); 

Renderer2DModel rendererModel = renderer.getRenderer2DModel();
rendererModel.set(StandardGenerator.AtomColor.class,
                  new UniColor(Color.BLACK));
rendererModel.set(StandardGenerator.Visibility.class,
                  SymbolVisibility.iupacRecommendations());
rendererModel.set(StandardGenerator.StrokeRatio.class,
                  0.85);
rendererModel.set(StandardGenerator.SymbolMarginRatio.class,
                  4d);

Using the above configuration, the following SVG can be generated. It is shown beside the current wikipedia SVG (attributed below).

"Koffein - Caffeine" by NEUROtiker - Own work. Licensed under Public domain via Wikimedia Commons.

Scaling

John M - todo, tutorial or correctly sizing PDF/SVG output