本文整理汇总了Java中org.openscience.cdk.renderer.font.AWTFontManager类的典型用法代码示例。如果您正苦于以下问题:Java AWTFontManager类的具体用法?Java AWTFontManager怎么用?Java AWTFontManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AWTFontManager类属于org.openscience.cdk.renderer.font包,在下文中一共展示了AWTFontManager类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: PictureGenerator
import org.openscience.cdk.renderer.font.AWTFontManager; //导入依赖的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.font.AWTFontManager; //导入依赖的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.font.AWTFontManager; //导入依赖的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: draw
import org.openscience.cdk.renderer.font.AWTFontManager; //导入依赖的package包/类
/**
* Low-level draw method used by other rendering methods.
*
* @param visitor the draw visitor
* @param viewBounds the view bounds - the diagram will be centered in the bounds
*/
void draw(IDrawVisitor visitor, Rectangle2D viewBounds, Rectangle2D drawBounds, IRenderingElement drawing) {
double zoomToFit = Math.min(viewBounds.getWidth() / (drawBounds.getWidth() * scale),
viewBounds.getHeight() / (drawBounds.getHeight() * scale));
// do blow up depiction only shrink
if (zoomToFit > 1)
zoomToFit = 1;
AffineTransform transform = new AffineTransform();
transform.translate(viewBounds.getCenterX(), viewBounds.getCenterY());
transform.scale(scale, -scale);
transform.scale(zoomToFit, zoomToFit);
transform.translate(-drawBounds.getCenterX(), -drawBounds.getCenterY());
// not always needed
AWTFontManager fontManager = new AWTFontManager();
fontManager.setFontForZoom(zoomToFit);
visitor.setRendererModel(parameters);
visitor.setFontManager(fontManager);
visitor.setTransform(transform);
// setup up transform
visitor.visit(drawing);
}
开发者ID:johnmay,项目名称:efficient-bits,代码行数:33,代码来源:AbstractDepiction.java
示例5: testSVGRenderer
import org.openscience.cdk.renderer.font.AWTFontManager; //导入依赖的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
示例6: draw
import org.openscience.cdk.renderer.font.AWTFontManager; //导入依赖的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
示例7: renderMolecule
import org.openscience.cdk.renderer.font.AWTFontManager; //导入依赖的package包/类
public Image renderMolecule(IMolecule molecule)
{
// 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);
StructureDiagramGenerator sdg = new StructureDiagramGenerator();
sdg.setMolecule(molecule);
try
{
sdg.generateCoordinates();
}
catch (Exception e)
{}
molecule = sdg.getMolecule();
// generators make the image elements
List<IAtomContainerGenerator> generators = new ArrayList<IAtomContainerGenerator>();
generators.add(new BasicBondGenerator());
MyAtomGenerator atomGenerator = new MyAtomGenerator(shouldShowHydrogens, shouldShowCarbons);
generators.add(atomGenerator);
// the renderer needs to have a toolkit-specific font manager
Renderer renderer = new Renderer(generators, new AWTFontManager());
// the call to 'setup' only needs to be done on the first paint
renderer.setup(molecule, drawArea);
// paint the background
Graphics2D g2 = (Graphics2D)image.getGraphics();
g2.setColor(Color.WHITE);
g2.fillRect(0, 0, width, height);
// the paint method also needs a toolkit-specific renderer
renderer.paintMolecule(molecule, new AWTDrawVisitor(g2), new Rectangle(0, 0, width, height), false);
return image;
}
开发者ID:dhmay,项目名称:msInspect,代码行数:40,代码来源:MoleculeRenderer2D.java
示例8: StandardSingleStructureImageGenerator
import org.openscience.cdk.renderer.font.AWTFontManager; //导入依赖的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
注:本文中的org.openscience.cdk.renderer.font.AWTFontManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论