Search in sources :

Example 1 with StandardGenerator

use of org.openscience.cdk.renderer.generators.standard.StandardGenerator in project ambit-mirror by ideaconsult.

the class CDK2DAtomColorsHalogens method createRenderer.

private IRenderer createRenderer(Dimension cellSize, Color background, boolean rings, boolean atomNumbers, boolean explicitH) {
    List<IGenerator<IAtomContainer>> generators = new ArrayList<IGenerator<IAtomContainer>>();
    Font font = new Font("Arial", Font.PLAIN, 12);
    generators.add(new BasicSceneGenerator());
    generators.add(new StandardGenerator(font));
    /*
 * 
 https://github.com/cdk/cdk/wiki/Standard-Generator
 */
    /*
		generators.add(new BasicBondGenerator());

		generators.add(new SelectBondGenerator());
		if (rings)
			generators.add(new RingGenerator());
		// generators.add(new MyBasicAtomGenerator()); //this was to clean the
		// background behind the labels
		generators.add(new BasicAtomGenerator());
		if (atomNumbers)
			generators.add(new AtomLabelGenerator());
		generators.add(new ImageMapGenerator());
		generators.add(new MySelectAtomGenerator());

		generators.add(new AtomAnnotationGenerator());

*/
    IRenderer renderer = new AtomContainerRenderer(generators, new AWTFontManager());
    RendererModel r2dm = renderer.getRenderer2DModel();
    r2dm.set(StandardGenerator.Highlighting.class, StandardGenerator.HighlightStyle.OuterGlow);
    /*
		RendererModelWrapper.setCompactShape(r2dm,
				BasicAtomGenerator.Shape.OVAL);

		if (atomNumbers)
			RendererModelWrapper.setDrawNumbers(r2dm, atomNumbers);

		RendererModelWrapper.setUseAntiAliasing(r2dm, true);

		// r2dm.set(paramType, value)
		RendererModelWrapper.setBackColor(r2dm, new Color(background.getRed(),
				background.getGreen(), background.getBlue(), 128));

		RendererModelWrapper.setShowExplicitHydrogens(r2dm, explicitH);

		RendererModelWrapper.setShowAromaticity(r2dm, true);

		RendererModelWrapper
				.setAtomColorer(r2dm, new CDK2DAtomColorsHalogens());
*/
    r2dm.set(StandardGenerator.AtomColor.class, new CDK2DAtomColors());
    return renderer;
}
Also used : BasicSceneGenerator(org.openscience.cdk.renderer.generators.BasicSceneGenerator) RendererModel(org.openscience.cdk.renderer.RendererModel) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IRenderer(org.openscience.cdk.renderer.IRenderer) AWTFontManager(org.openscience.cdk.renderer.font.AWTFontManager) IGenerator(org.openscience.cdk.renderer.generators.IGenerator) ArrayList(java.util.ArrayList) StandardGenerator(org.openscience.cdk.renderer.generators.standard.StandardGenerator) AtomContainerRenderer(org.openscience.cdk.renderer.AtomContainerRenderer) CDK2DAtomColors(org.openscience.cdk.renderer.color.CDK2DAtomColors) Font(java.awt.Font)

Aggregations

Font (java.awt.Font)1 ArrayList (java.util.ArrayList)1 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)1 AtomContainerRenderer (org.openscience.cdk.renderer.AtomContainerRenderer)1 IRenderer (org.openscience.cdk.renderer.IRenderer)1 RendererModel (org.openscience.cdk.renderer.RendererModel)1 CDK2DAtomColors (org.openscience.cdk.renderer.color.CDK2DAtomColors)1 AWTFontManager (org.openscience.cdk.renderer.font.AWTFontManager)1 BasicSceneGenerator (org.openscience.cdk.renderer.generators.BasicSceneGenerator)1 IGenerator (org.openscience.cdk.renderer.generators.IGenerator)1 StandardGenerator (org.openscience.cdk.renderer.generators.standard.StandardGenerator)1