⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 omiconfactory.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 JAVA
字号:
// **********************************************************************// // <copyright>// //  BBN Technologies//  10 Moulton Street//  Cambridge, MA 02138//  (617) 873-8000// //  Copyright (C) BBNT Solutions LLC. All rights reserved.// // </copyright>// **********************************************************************// // $Source: /cvs/distapps/openmap/src/openmap/com/bbn/openmap/tools/icon/OMIconFactory.java,v $// $RCSfile: OMIconFactory.java,v $// $Revision: 1.2.2.1 $// $Date: 2004/10/14 18:27:43 $// $Author: dietrick $// // **********************************************************************package com.bbn.openmap.tools.icon;import java.awt.Graphics2D;import java.awt.RenderingHints;import java.awt.image.BufferedImage;import javax.swing.ImageIcon;import com.bbn.openmap.omGraphics.DrawingAttributes;/** * The OMIconFactory is a factory to build ImageIcons, with content * described by IconParts for a certain size. */public class OMIconFactory {    /**     * Create an ImageIcon that is a certain pixel height and width.     * This will return an empty ImageIcon, and you'd have to do the     * rendering into its image.     */    public static ImageIcon createImageIcon(int width, int height) {        return createImageIcon(width, height, BufferedImage.TYPE_INT_ARGB);    }    /**     * Create an ImageIcon that is a certain pixel height and width,     * with a specified image type (ARGB, RGB, etc). This will return     * an empty ImageIcon, and you'd have to do the rendering into its     * image.     */    public static ImageIcon createImageIcon(int width, int height, int imageType) {        return new ImageIcon(new BufferedImage(width, height, imageType));    }    /**     * Create an ImageIcon that is a certain pixel height and width     * created with a certain IconPart geometry. The geometry will be     * drawing with default DrawingAttributes.     */    public static ImageIcon getIcon(int width, int height, IconPart geometry) {        return getIcon(width, height, geometry, null);    }    /**     * Create an ImageIcon that is a certain pixel height and width     * created with a certain IconPart geometry. Also, the     * DrawingAttributes can be used to add color/texture to the     * IconPart geometries.     */    public static ImageIcon getIcon(int width, int height, IconPart geometry,                                    DrawingAttributes appDA) {        ImageIcon icon = createImageIcon(width, height);        Graphics2D g = (Graphics2D) icon.getImage().getGraphics();        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,                RenderingHints.VALUE_ANTIALIAS_ON);        geometry.render(g, width, height, appDA);        return icon;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -