亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? map.java

?? JAVA的一些源碼 JAVA2 STANDARD EDITION DEVELOPMENT KIT 5.0
?? JAVA
字號:
/* * @(#)Map.java	1.8 03/12/19 * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */package javax.swing.text.html;import java.awt.Polygon;import java.awt.Rectangle;import java.util.StringTokenizer;import java.util.Vector;import javax.swing.text.AttributeSet;/** * Map is used to represent a map element that is part of an HTML document. * Once a Map has been created, and any number of areas have been added, * you can test if a point falls inside the map via the contains method. * * @author  Scott Violet * @version 1.8 12/19/03 */class Map {    /** Name of the Map. */    private String           name;    /** An array of AttributeSets. */    private Vector           areaAttributes;    /** An array of RegionContainments, will slowly grow to match the     * length of areaAttributes as needed. */    private Vector           areas;    public Map() {    }    public Map(String name) {	this.name = name;    }    /**     * Returns the name of the Map.     */    public String getName() {	return name;    }    /**     * Defines a region of the Map, based on the passed in AttributeSet.     */    public void addArea(AttributeSet as) {	if (as == null) {	    return;	}	if (areaAttributes == null) {	    areaAttributes = new Vector(2);	}	areaAttributes.addElement(as.copyAttributes());    }    /**     * Removes the previously created area.     */    public void removeArea(AttributeSet as) {	if (as != null && areaAttributes != null) {	    int numAreas = (areas != null) ? areas.size() : 0;	    for (int counter = areaAttributes.size() - 1; counter >= 0;		 counter--) {		if (((AttributeSet)areaAttributes.elementAt(counter)).		    isEqual(as)){		    areaAttributes.removeElementAt(counter);		    if (counter < numAreas) {			areas.removeElementAt(counter);		    }		}	    }	}    }    /**     * Returns the AttributeSets representing the differet areas of the Map.     */    public AttributeSet[] getAreas() {	int numAttributes = (areaAttributes != null) ? areaAttributes.size() :	                    0;	if (numAttributes != 0) {	    AttributeSet[]    retValue = new AttributeSet[numAttributes];	    areaAttributes.copyInto(retValue);	    return retValue;	}	return null;    }    /**     * Returns the AttributeSet that contains the passed in location,     * <code>x</code>, <code>y</code>. <code>width</code>, <code>height</code>     * gives the size of the region the map is defined over. If a matching     * area is found, the AttribueSet for it is returned.     */    public AttributeSet getArea(int x, int y, int width, int height) {	int      numAttributes = (areaAttributes != null) ?	                         areaAttributes.size() : 0;	if (numAttributes > 0) {	    int      numAreas = (areas != null) ? areas.size() : 0;	    if (areas == null) {		areas = new Vector(numAttributes);	    }	    for (int counter = 0; counter < numAttributes; counter++) {		if (counter >= numAreas) {		    areas.addElement(createRegionContainment			    ((AttributeSet)areaAttributes.elementAt(counter)));		}		RegionContainment       rc = (RegionContainment)areas.                                             elementAt(counter);		if (rc != null && rc.contains(x, y, width, height)) {		    return (AttributeSet)areaAttributes.elementAt(counter);		}	    }	}	return null;    }    /**     * Creates and returns an instance of RegionContainment that can be     * used to test if a particular point lies inside a region.     */    protected RegionContainment createRegionContainment	                          (AttributeSet attributes) {	Object     shape = attributes.getAttribute(HTML.Attribute.SHAPE);	if (shape == null) {	    shape = "rect";	}	if (shape instanceof String) {	    String                shapeString = ((String)shape).toLowerCase();	    RegionContainment     rc = null;	    try {		if (shapeString.equals("rect")) {		    rc = new RectangleRegionContainment(attributes);		}		else if (shapeString.equals("circle")) {		    rc = new CircleRegionContainment(attributes);		}		else if (shapeString.equals("poly")) {		    rc = new PolygonRegionContainment(attributes);		}		else if (shapeString.equals("default")) {		    rc = DefaultRegionContainment.sharedInstance();		}	    } catch (RuntimeException re) {		// Something wrong with attributes.		rc = null;	    }	    return rc;	}	return null;    }    /**     * Creates and returns an array of integers from the String     * <code>stringCoords</code>. If one of the values represents a     * % the returned value with be negative. If a parse error results     * from trying to parse one of the numbers null is returned.     */    static protected int[] extractCoords(Object stringCoords) {	if (stringCoords == null || !(stringCoords instanceof String)) {	    return null;	}	StringTokenizer    st = new StringTokenizer((String)stringCoords,						    ", \t\n\r");	int[]              retValue = null;	int                numCoords = 0;	while(st.hasMoreElements()) {	    String         token = st.nextToken();	    int            scale;	    if (token.endsWith("%")) {		scale = -1;		token = token.substring(0, token.length() - 1);	    }	    else {		scale = 1;	    }	    try {		int       intValue = Integer.parseInt(token);		if (retValue == null) {		    retValue = new int[4];		}		else if(numCoords == retValue.length) {		    int[]    temp = new int[retValue.length * 2];		    System.arraycopy(retValue, 0, temp, 0, retValue.length);		    retValue = temp;		}		retValue[numCoords++] = intValue * scale;	    } catch (NumberFormatException nfe) {		return null;	    }	}	if (numCoords > 0 && numCoords != retValue.length) {	    int[]    temp = new int[numCoords];	    System.arraycopy(retValue, 0, temp, 0, numCoords);	    retValue = temp;	}	return retValue;    }    /**     * Defines the interface used for to check if a point is inside a     * region.     */    interface RegionContainment {	/**	 * Returns true if the location <code>x</code>, <code>y</code>	 * falls inside the region defined in the receiver.	 * <code>width</code>, <code>height</code> is the size of	 * the enclosing region.	 */	public boolean contains(int x, int y, int width, int height);    }    /**     * Used to test for containment in a rectangular region.     */    static class RectangleRegionContainment implements RegionContainment {	/** Will be non-null if one of the values is a percent, and any value	 * that is non null indicates it is a percent	 * (order is x, y, width, height). */	float[]       percents;	/** Last value of width passed in. */	int           lastWidth;	/** Last value of height passed in. */	int           lastHeight;        /** Top left. */        int           x0;        int           y0;        /** Bottom right. */        int           x1;        int           y1;	public RectangleRegionContainment(AttributeSet as) {	    int[]    coords = Map.extractCoords(as.getAttribute(HTML.							   Attribute.COORDS));	    percents = null;	    if (coords == null || coords.length != 4) {		throw new RuntimeException("Unable to parse rectangular area");	    }	    else {		x0 = coords[0];		y0 = coords[1];		x1 = coords[2];		y1 = coords[3];		if (x0 < 0 || y0 < 0 || x1 < 0 || y1 < 0) {		    percents = new float[4];		    lastWidth = lastHeight = -1;		    for (int counter = 0; counter < 4; counter++) {			if (coords[counter] < 0) {			    percents[counter] = Math.abs				        (coords[counter]) / 100.0f;			}			else {			    percents[counter] = -1.0f;			}		    }		}	    }	}	public boolean contains(int x, int y, int width, int height) {	    if (percents == null) {		return contains(x, y);	    }	    if (lastWidth != width || lastHeight != height) {		lastWidth = width;		lastHeight = height;		if (percents[0] != -1.0f) {		    x0 = (int)(percents[0] * width);		}		if (percents[1] != -1.0f) {		    y0 = (int)(percents[1] * height);		}		if (percents[2] != -1.0f) {		    x1 = (int)(percents[2] * width);		}		if (percents[3] != -1.0f) {		    y1 = (int)(percents[3] * height);		}	    }	    return contains(x, y);	}        public boolean contains(int x, int y) {            return ((x >= x0 && x <= x1) &&                    (y >= y0 && y <= y1));        }    }    /**     * Used to test for containment in a polygon region.     */    static class PolygonRegionContainment extends Polygon implements	         RegionContainment {	/** If any value is a percent there will be an entry here for the	 * percent value. Use percentIndex to find out the index for it. */	float[]           percentValues;	int[]             percentIndexs;	/** Last value of width passed in. */	int               lastWidth;	/** Last value of height passed in. */	int               lastHeight;	public PolygonRegionContainment(AttributeSet as) {	    int[]    coords = Map.extractCoords(as.getAttribute(HTML.Attribute.								COORDS));	    if (coords == null || coords.length == 0 ||		coords.length % 2 != 0) {		throw new RuntimeException("Unable to parse polygon area");	    }	    else {		int        numPercents = 0;		lastWidth = lastHeight = -1;		for (int counter = coords.length - 1; counter >= 0;		     counter--) {		    if (coords[counter] < 0) {			numPercents++;		    }		}		if (numPercents > 0) {		    percentIndexs = new int[numPercents];		    percentValues = new float[numPercents];		    for (int counter = coords.length - 1, pCounter = 0;			 counter >= 0; counter--) {			if (coords[counter] < 0) {			    percentValues[pCounter] = coords[counter] /				                      -100.0f;			    percentIndexs[pCounter] = counter;			    pCounter++;			}		    }		}		else {		    percentIndexs = null;		    percentValues = null;		}		npoints = coords.length / 2;		xpoints = new int[npoints];		ypoints = new int[npoints];				for (int counter = 0; counter < npoints; counter++) {		    xpoints[counter] = coords[counter + counter];		    ypoints[counter] = coords[counter + counter + 1];		}	    }	}	public boolean contains(int x, int y, int width, int height) {	    if (percentValues == null || (lastWidth == width &&					  lastHeight == height)) {		return contains(x, y);	    }	    // Force the bounding box to be recalced.	    bounds = null;	    lastWidth = width;	    lastHeight = height;	    float fWidth = (float)width;	    float fHeight = (float)height;	    for (int counter = percentValues.length - 1; counter >= 0;		 counter--) {		if (percentIndexs[counter] % 2 == 0) {		    // x		    xpoints[percentIndexs[counter] / 2] = 			    (int)(percentValues[counter] * fWidth);		}		else {		    // y		    ypoints[percentIndexs[counter] / 2] = 			    (int)(percentValues[counter] * fHeight);		}	    }	    return contains(x, y);	}    }    /**     * Used to test for containment in a circular region.     */    static class CircleRegionContainment implements RegionContainment {	/** X origin of the circle. */	int           x;	/** Y origin of the circle. */	int           y;	/** Radius of the circle. */	int           radiusSquared;	/** Non-null indicates one of the values represents a percent. */	float[]       percentValues;	/** Last value of width passed in. */	int           lastWidth;	/** Last value of height passed in. */	int           lastHeight;	public CircleRegionContainment(AttributeSet as) {	    int[]    coords = Map.extractCoords(as.getAttribute(HTML.Attribute.								COORDS));	    if (coords == null || coords.length != 3) {		throw new RuntimeException("Unable to parse circular area");	    }	    x = coords[0];	    y = coords[1];	    radiusSquared = coords[2] * coords[2];	    if (coords[0] < 0 || coords[1] < 0 || coords[2] < 0) {		lastWidth = lastHeight = -1;		percentValues = new float[3];		for (int counter = 0; counter < 3; counter++) {		    if (coords[counter] < 0) {			percentValues[counter] = coords[counter] /			                         -100.0f;		    }		    else {			percentValues[counter] = -1.0f;		    }		}	    }	    else {		percentValues = null;	    }	}	public boolean contains(int x, int y, int width, int height) {	    if (percentValues != null && (lastWidth != width ||					  lastHeight != height)) {		int      newRad = Math.min(width, height) / 2;		lastWidth = width;		lastHeight = height;		if (percentValues[0] != -1.0f) {		    this.x = (int)(percentValues[0] * width);		}		if (percentValues[1] != -1.0f) {		    this.y = (int)(percentValues[1] * height);		}		if (percentValues[2] != -1.0f) {		    radiusSquared = (int)(percentValues[2] * 				   Math.min(width, height));		    radiusSquared *= radiusSquared;		}	    }	    return (((x - this.x) * (x - this.x) +		     (y - this.y) * (y - this.y)) <= radiusSquared);	}    }    /**     * An implementation that will return true if the x, y location is     * inside a rectangle defined by origin 0, 0, and width equal to     * width passed in, and height equal to height passed in.     */    static class DefaultRegionContainment implements RegionContainment {	/** A global shared instance. */	static DefaultRegionContainment  si = null;	public static DefaultRegionContainment sharedInstance() {	    if (si == null) {		si = new DefaultRegionContainment();	    }	    return si;	}	public boolean contains(int x, int y, int width, int height) {	    return (x <= width && x >= 0 && y >= 0 && y <= width);	}    }}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品av综合导航| 亚洲va韩国va欧美va| 欧美精品一区二区三区高清aⅴ | 亚洲gay无套男同| 有码一区二区三区| 洋洋成人永久网站入口| 亚洲精品视频在线观看免费| 亚洲欧洲中文日韩久久av乱码| 国产精品欧美一区二区三区| 国产精品乱码一区二区三区软件| 国产精品国产精品国产专区不蜜 | 日韩欧美国产电影| 精品久久久网站| 国产三级久久久| 国产精品伦一区二区三级视频| 国产精品福利影院| 曰韩精品一区二区| 日韩av在线发布| 国产一区在线观看视频| 国产成人aaaa| 色香蕉久久蜜桃| 555www色欧美视频| 精品久久一区二区| 国产精品久久久久久久久晋中 | 麻豆国产精品视频| 蜜臀av性久久久久av蜜臀妖精| 开心九九激情九九欧美日韩精美视频电影| 日韩专区一卡二卡| 久久99久久久欧美国产| 懂色av一区二区三区蜜臀| 91网站最新地址| 欧美理论片在线| 精品成人佐山爱一区二区| 国产精品久久国产精麻豆99网站 | 成人app在线| 欧美日韩一区久久| 欧美va天堂va视频va在线| 国产欧美精品在线观看| 一个色综合网站| 狠狠色综合日日| 色综合久久综合中文综合网| 宅男噜噜噜66一区二区66| 国产三级三级三级精品8ⅰ区| 成人欧美一区二区三区黑人麻豆| 午夜欧美视频在线观看| 国产伦精品一区二区三区免费迷 | 91精品福利在线一区二区三区 | 自拍偷在线精品自拍偷无码专区| 亚洲国产一区二区三区青草影视| 久草这里只有精品视频| 91亚洲午夜精品久久久久久| 欧美一区二区女人| 亚洲桃色在线一区| 精品一区二区精品| 欧美在线制服丝袜| 亚洲国产高清不卡| 蜜桃视频一区二区三区在线观看 | 久久久久久综合| 亚洲大片精品永久免费| 国产成人免费av在线| 欧美日韩免费视频| 国产精品第四页| 久久91精品久久久久久秒播| 欧亚一区二区三区| 中文字幕欧美国产| 韩国三级在线一区| 69成人精品免费视频| 亚洲精品自拍动漫在线| 国产成人午夜精品影院观看视频| 51精品视频一区二区三区| 国产精品电影院| 国产盗摄女厕一区二区三区| 欧美一区二区三区人| 亚洲免费观看高清在线观看| 国产成人免费在线观看不卡| 欧美一区二区三区婷婷月色| 一区二区成人在线| 99精品一区二区| 国产日韩v精品一区二区| 久久电影网电视剧免费观看| 欧美调教femdomvk| 一区二区三区影院| jlzzjlzz亚洲女人18| 久久九九99视频| 另类的小说在线视频另类成人小视频在线 | 国产很黄免费观看久久| 日韩三级中文字幕| 亚洲二区在线观看| 久久精品在线免费观看| 美女性感视频久久| 3d动漫精品啪啪一区二区竹菊| 亚洲综合一区二区| 色综合久久88色综合天天| 国产精品天美传媒沈樵| 高清不卡在线观看| 国产精品三级视频| 丁香一区二区三区| 日本一区二区三区免费乱视频| 国产在线精品免费| 26uuu国产日韩综合| 韩国女主播成人在线| 亚洲精品一线二线三线无人区| 老司机精品视频线观看86| 欧美一级理论片| 久草中文综合在线| 久久久美女艺术照精彩视频福利播放| 精品一区二区免费| 久久精品视频在线看| 国产高清不卡一区二区| 欧美韩日一区二区三区| 不卡视频在线看| 亚洲欧美日韩在线| 欧美午夜不卡视频| 人人超碰91尤物精品国产| 91精品国产aⅴ一区二区| 蜜桃av噜噜一区| 久久免费午夜影院| 99久久国产综合精品女不卡| 亚洲欧洲精品天堂一级| 在线观看视频一区二区欧美日韩| 亚洲第一福利一区| 精品久久人人做人人爰| 国产精品白丝av| 综合激情成人伊人| 欧美视频一区二区三区四区| 奇米四色…亚洲| 国产亚洲综合色| 91视频xxxx| 日本中文一区二区三区| 久久嫩草精品久久久久| 成人av在线一区二区| 亚洲国产精品久久人人爱蜜臀| 在线成人免费视频| 国产精品综合二区| 一区二区三区在线视频播放| 在线综合亚洲欧美在线视频| 国产一区二区在线视频| 中文字幕综合网| 91精品视频网| 成人免费毛片高清视频| 亚洲资源中文字幕| 国产精品99精品久久免费| 欧美在线免费视屏| 日韩欧美激情在线| 国产不卡视频一区二区三区| 亚洲男同性恋视频| 欧美电影免费提供在线观看| 成人av影院在线| 爽好多水快深点欧美视频| 久久综合狠狠综合久久激情| 99久久精品免费看国产免费软件| 香蕉成人啪国产精品视频综合网| 久久久精品免费免费| 91成人在线精品| 国产精品综合视频| 五月天久久比比资源色| 国产日韩欧美一区二区三区乱码 | 99re成人精品视频| 免费久久精品视频| 中文字幕视频一区二区三区久| 宅男噜噜噜66一区二区66| 99re亚洲国产精品| 欧洲视频一区二区| 国产精品1区2区3区| 亚瑟在线精品视频| 国产精品理论在线观看| 日韩免费观看高清完整版| 97精品国产露脸对白| 国产中文字幕一区| 无码av免费一区二区三区试看| 久久久久久久精| 91精品欧美一区二区三区综合在 | 制服丝袜成人动漫| 99国产精品久久久久久久久久| 激情综合网天天干| 亚洲电影第三页| 亚洲欧美视频一区| 国产视频一区不卡| 欧美精品1区2区3区| 91污在线观看| 成人免费av网站| 国产成人激情av| 精品一区二区影视| 日韩av中文字幕一区二区 | 成人av在线资源| 韩国av一区二区| 老司机精品视频一区二区三区| 一区二区三区精品视频在线| 国产精品女人毛片| 久久精品日产第一区二区三区高清版| 日韩一区二区三区在线视频| 欧美日韩一区二区三区不卡| 一本一道综合狠狠老| 91在线观看地址| 波多野结衣91| 99久久婷婷国产精品综合| 丁香婷婷深情五月亚洲| 国产精品中文欧美| 国产精品一卡二卡| 国产91在线观看丝袜|