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

📄 mapgenerator.java

📁 动画素材图像语义标注系统:该系统实现对图片的语义标注
💻 JAVA
字号:
/**
 *  MapGenerator.java - utility method to generate MoinMoin Wiki Imagemap code
 *  original source taken from Mark Bryan Yu,  jimagemapper.sourceforge.net
 *
 * This file was modified by
 * Heiko Schroeder
 * wikiimagemapper.sourceforge.net
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package cn.dxm.client;

import java.awt.datatransfer.*;
import java.util.List;
import java.util.Iterator;
import java.awt.*;

public class MapGenerator{
    public static void generateImageMap(String imageName, List shapes) {
        StringBuffer buffer = new StringBuffer();
		buffer.append("{{{\n#!ImageMap\n");
		buffer.append(imageName).append("\n");

        Iterator iter = shapes.iterator();
        while(iter.hasNext()) {
            Object o = iter.next();
            if(o instanceof Rectangle) {
                Rectangle rect = (Rectangle) o;
				buffer.append(rect.getAttribute().generateHtmlCode());
				buffer.append("shape=\"rect\";coords=\"");
                buffer.append(rect.getX()).append(",").append(rect.getY()).append(",").append(rect.getX() + rect.getWidth()).append(",");
                buffer.append(rect.getY() + rect.getHeight()).append("\"\n");
            } 
        }
        buffer.append("}}}");

		/*
		 * The following code part puts the formated imagemap code to the clipboard
		 */
		SecurityManager sm = System.getSecurityManager();
		if (sm != null) {
        try {
           sm.checkSystemClipboardAccess();
           }
        catch (Exception e) {e.printStackTrace();}
        }
		Toolkit tk = Toolkit.getDefaultToolkit();
		StringSelection st = new StringSelection(buffer.toString());
		tk.getSystemClipboard().setContents(st, null);
    }
}

⌨️ 快捷键说明

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