本文整理汇总了Java中org.openscience.cdk.renderer.generators.IGenerator类的典型用法代码示例。如果您正苦于以下问题:Java IGenerator类的具体用法?Java IGenerator怎么用?Java IGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IGenerator类属于org.openscience.cdk.renderer.generators包,在下文中一共展示了IGenerator类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: PictureGenerator
import org.openscience.cdk.renderer.generators.IGenerator; //导入依赖的package包/类
public PictureGenerator() {
// generators make the image elements
List<IGenerator<IAtomContainer>> generators = new ArrayList<IGenerator<IAtomContainer>>();
this.bsg = new BasicSceneGenerator();
generators.add(this.bsg);
this.bbg = new BasicBondGenerator();
generators.add(this.bbg);
this.atomGenerator = new BasicAtomGenerator();
generators.add(this.atomGenerator);
this.renderer = new AtomContainerRenderer(generators, new AWTFontManager());
this.model = renderer.getRenderer2DModel();
// For smiles convertion
this.sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
this.sp.setPreservingAromaticity(true);
}
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:18,代码来源:PictureGenerator.java
示例2: Structure2DComponent
import org.openscience.cdk.renderer.generators.IGenerator; //导入依赖的package包/类
public Structure2DComponent(String structure) throws CDKException,
IOException {
// Create a silend CDK builder
IChemObjectBuilder builder = SilentChemObjectBuilder.getInstance();
// Create a new molecule instance
molecule = builder.newInstance(IAtomContainer.class);
// Load the structure into the molecule
MDLV2000Reader molReader = new MDLV2000Reader(new StringReader(
structure));
molReader.read(molecule);
molReader.close();
// Suppress the hydrogens
AtomContainerManipulator.suppressHydrogens(molecule);
// If the model has no coordinates, let's generate them
if (!GeometryUtil.has2DCoordinates(molecule)) {
StructureDiagramGenerator sdg = new StructureDiagramGenerator();
sdg.setMolecule(molecule, false);
sdg.generateCoordinates();
}
// Generators make the image elements
Font font = new Font("Verdana", Font.PLAIN, 14);
List<IGenerator<IAtomContainer>> generators = new ArrayList<IGenerator<IAtomContainer>>();
generators.add(new BasicSceneGenerator());
generators.add(new StandardGenerator(font));
// Renderer needs to have a toolkit-specific font manager
renderer = new AtomContainerRenderer(generators, new AWTFontManager());
// Set default atom colors for the renderer
RendererModel rendererModel = renderer.getRenderer2DModel();
rendererModel.set(StandardGenerator.AtomColor.class,
new CDK2DAtomColors());
}
开发者ID:mzmine,项目名称:mzmine2,代码行数:41,代码来源:Structure2DComponent.java
示例3: AbstractPictureGenerator
import org.openscience.cdk.renderer.generators.IGenerator; //导入依赖的package包/类
public AbstractPictureGenerator(IGenerator<IAtomContainer> atomGenerator) {
// generators make the image elements
List<IGenerator<IAtomContainer>> generators = new ArrayList<IGenerator<IAtomContainer>>();
this.bsg = new BasicSceneGenerator();
generators.add(this.bsg);
this.bbg = new BasicBondGenerator();
generators.add(this.bbg);
this.atomGenerator = atomGenerator;
generators.add(this.atomGenerator);
this.renderer = new AtomContainerRenderer(generators, new AWTFontManager());
this.model = renderer.getRenderer2DModel();
}
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:14,代码来源:AbstractPictureGenerator.java
示例4: testSVGRenderer
import org.openscience.cdk.renderer.generators.IGenerator; //导入依赖的package包/类
@Test
public void testSVGRenderer() throws IOException {
int width = 200;
int height = 200;
Rectangle drawArea = new Rectangle(width, height);
Image image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
IAtomContainer triazole = MoleculeFactory.make123Triazole();
StructureDiagramGenerator sdg = new StructureDiagramGenerator();
sdg.setMolecule(triazole);
try {
sdg.generateCoordinates();
} catch (Exception e) {
}
triazole = sdg.getMolecule();
List<IGenerator<IAtomContainer>> generators = new ArrayList<IGenerator<IAtomContainer>>();
generators.add(new BasicSceneGenerator());
generators.add(new BasicBondGenerator());
generators.add(new BasicAtomGenerator());
AtomContainerRenderer renderer = new AtomContainerRenderer(generators, new AWTFontManager());
renderer.setup(triazole, drawArea);
Graphics2D g2 = (Graphics2D) image.getGraphics();
SVGRenderer svgR = new SVGRenderer(g2);
renderer.paint(triazole, new AWTDrawVisitor(svgR));
SVGUtil.debug(svgR.getSVG(), new FileOutputStream(getClass().getResource("/uk/ac/cam/ch/ucc/svggraphics2d/").getFile() + "testOutputTriazole.svg"), 0);
Assert.assertEquals("Test for number of SVG elements", 13, svgR.getSVG().getChildCount());
}
开发者ID:AndyHowlettGitHub,项目名称:SVGGraphics2D,代码行数:37,代码来源:SVGRendererTest.java
示例5: draw
import org.openscience.cdk.renderer.generators.IGenerator; //导入依赖的package包/类
public static void draw(IAtomContainer mol, String imageName){
int WIDTH = 500;
int HEIGHT = 500;
// the draw area and the image should be the same size
Rectangle drawArea = new Rectangle(WIDTH, HEIGHT);
Image image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
// generators make the image elements
List<IGenerator<IAtomContainer>> generators = new ArrayList<IGenerator<IAtomContainer>>();
generators.add(new BasicSceneGenerator());
generators.add(new BasicBondGenerator());
generators.add(new BasicAtomGenerator());
// the renderer needs to have a toolkit-specific font manager
AtomContainerRenderer renderer = new AtomContainerRenderer(generators, new AWTFontManager());
// the call to 'setup' only needs to be done on the first paint
renderer.setup(mol, drawArea);
// paint the background
Graphics2D g2 = (Graphics2D)image.getGraphics();
g2.setColor(Color.WHITE);
g2.fillRect(0, 0, WIDTH, HEIGHT);
IDrawVisitor drawVisitor = new AWTDrawVisitor(g2);
// the paint method also needs a toolkit-specific renderer
renderer.paint(mol, drawVisitor);
try {
ImageIO.write((RenderedImage)image, "PNG", new File(imageName+".png"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
开发者ID:ndaniels,项目名称:Ammolite,代码行数:40,代码来源:MolDrawer.java
示例6: StandardSingleStructureImageGenerator
import org.openscience.cdk.renderer.generators.IGenerator; //导入依赖的package包/类
public StandardSingleStructureImageGenerator(Font font) {
java.util.List<IGenerator<IAtomContainer>> generators = new java.util.ArrayList<IGenerator<IAtomContainer>>();
generators.add(new BasicSceneGenerator());
generators.add(new StandardGenerator(font));
this.renderer = new AtomContainerRenderer(generators, new AWTFontManager());
}
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:7,代码来源:StandardSingleStructureImageGenerator.java
示例7: DepictionGenerator
import org.openscience.cdk.renderer.generators.IGenerator; //导入依赖的package包/类
DepictionGenerator(List<IGenerator<IAtomContainer>> generators) {
this.generators = generators;
this.parameters = new RendererModel();
for (IGenerator<IAtomContainer> generator : generators)
parameters.registerParameters(generator);
}
开发者ID:johnmay,项目名称:efficient-bits,代码行数:7,代码来源:DepictionGenerator.java
示例8: getDiagram
import org.openscience.cdk.renderer.generators.IGenerator; //导入依赖的package包/类
private ElementGroup getDiagram(IAtomContainer container) {
ElementGroup primitives = new ElementGroup();
for (IGenerator<IAtomContainer> generator : generators)
primitives.add(generator.generate(container, parameters));
return primitives;
}
开发者ID:johnmay,项目名称:efficient-bits,代码行数:7,代码来源:DepictionGenerator.java
注:本文中的org.openscience.cdk.renderer.generators.IGenerator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论