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

📄 gridcell.java

📁 生物物种进化历程的演示
💻 JAVA
字号:
/*  Copyright (c) 2002 Compaq Computer Corporation     SOFTWARE RELEASE     Permission is hereby granted, free of charge, to any person obtaining  a copy of this software and associated documentation files (the  "Software"), to deal in the Software without restriction, including  without limitation the rights to use, copy, modify, merge, publish,  distribute, sublicense, and/or sell copies of the Software, and to  permit persons to whom the Software is furnished to do so, subject to  the following conditions:     - Redistributions of source code must retain the above copyright  notice, this list of conditions and the following disclaimer.     - Redistributions in binary form must reproduce the above copyright  notice, this list of conditions and the following disclaimer in the  documentation and/or other materials provided with the distribution.     - Neither the names of Compaq Research, Compaq Computer Corporation  nor the names of its contributors may be used to endorse or promote  products derived from this Software without specific prior written  permission.     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   IN NO EVENT SHALL COMPAQ COMPUTER CORPORATION BE LIABLE FOR ANY CLAIM,  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR  OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR  THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/package AccordionDrawer;/** * A class representing a cell in the quad tree data structure *  * A GridCell can have up to four (4) kid cells and may have a parent cell *  * @author  Tamara Munzner, Serdar Tasiran * @version  * @see     AccordionDrawer * @see     AccordionDrawer.GridCell */public class GridCell {	// the comparable is needed to sort gridcells when they get added to the drawing queue	//  (ToDrawQ in AccordionDrawer.addCellToQueue)    protected static int countRecurse;	protected static int countSubpixelRecurse;	protected static int countBBoxDraw;//	protected static NumberFormat nf = NumberFormat.getInstance();    public int objmin, objmax;    /**     * Storage for *up to* four kid cells     * kidCells storage is [row][col] like the grid, not [rowcol][element] like     * other variables in GridCell     */     int minLine[] = new int[2];    int maxLine[] = new int[2];        // only accessed by local get/set//    protected CellGeom cellGeom; // needed only for binary cells//    int computedFrame;    protected int drawnFrame; // needed to cache results for drawing parents in tree//    protected int rangeCachedFrame;//    protected int enqueuedFrame;//    public int drewMarkedAttachedFrame;    public AccordionDrawer drawer;    // not used//	public CellGeom getCellGeom()//	{//		return cellGeom;//	}    public GridCell(AccordionDrawer drawer) {//	computedFrame = -1;//    	// set but not used//	objmin = Integer.MAX_VALUE; // set these later//	objmax = -1;                // with the functions	minLine[AccordionDrawer.X] = maxLine[AccordionDrawer.X] =		minLine[AccordionDrawer.Y] = maxLine[AccordionDrawer.Y] = -1;//	nf.setMinimumFractionDigits(3);	this.drawer = drawer;    }	public static void incrementCountBBoxDraw()	{		countBBoxDraw++;	}    public void setDrawBackground(boolean on) {		drawer.drawBackground = on;    }	/////////////////////////////////////////////////////////////////////		public double getMin(int xy)	{		return drawer.splitLine[xy].getAbsoluteValue(minLine[xy], drawer.getFrameNum());//		SplitLine splitLine = drawer.splitLine[xy];//		if (minLine[xy] == -1 || ((drawer.bottomSize[xy])) == 1) // minLine is the min stuck position//			return splitLine.minStuckValue;//			splitLine.computePlaceThisFrame(minLine[xy], drawer.getFrameNum());//		return splitLine.splitCells[minLine[xy]].absoluteValue;	}    	/////////////////////////////////////////////////////////////////////	public double getMax(int xy)	{		return drawer.splitLine[xy].getAbsoluteValue(maxLine[xy], drawer.getFrameNum());//		SplitLine splitLine = drawer.splitLine[xy];//			if (maxLine[xy] == drawer.getBottomGrid( xy == 0 ? true : false) || drawer.bottomSize[xy]  == 1) // maxLine is the max stuck position//						return splitLine.maxStuckValue;//			splitLine.computePlaceThisFrame(maxLine[xy], drawer.getFrameNum());//		return splitLine.splitCells[maxLine[xy]].absoluteValue;	}	/////////////////////////////////////////////////////////////////////			public double getSize(int xy)	{		return getMax(xy) - getMin(xy);	}//	///////////////////////////////////////////////////////////////////	/**	 * Computes an ArrayList of features (CellGeom's, like TreeNode or	 * TreeEdge) that are "picked", i.e., are around (x,y) in screen	 * coordinates and are attached to this GridCell	 * 	 * Recurses down the quadtree hierarchy, starting at this	 * GridCell, until at least one picked object is found or the	 * bottom of the hierarchy is reached.	 *	 *	 * @author   Tamara Munzner, Serdar Tasiran, Li Zhang, Yunhong Zhou	 * 	 */			    	public CellGeom pickAttached(int x, int y) {		System.out.println("this function should use the data structure instead of the grid structure to pick geoms that don't belong to this object");		return null;	}//	// (called by something)^2 not called//    public int getObjMin() {return objmin;}//    public int getObjMax() {return objmax;}    //    // not called//    public void setObjMin(int n) { objmin = n;}//    public void setObjMax(int n) { objmax = n;}	public int getMinLine(int xy) { return minLine[xy];}	public int getMaxLine(int xy) { return maxLine[xy];}    public String print(int indent) {    	String returnString = "";		for (int i = 0; i < indent; i++) 		    returnString += " ";//		returnString += "["+ objmin + "->" + objmax + "]";		return returnString;    }    //	/**//	 * @return//	 *///	public int getDrewMarkedAttachedFrame() {//		return drewMarkedAttachedFrame;//	}////	/**//	 * @param i//	 *///	public void setDrewMarkedAttachedFrame(int i) {//		drewMarkedAttachedFrame = i;//	}//	/**//	 * @param geom//	 *///	public void setCellGeom(CellGeom geom) {//		cellGeom = geom;//	}	/**	 * @param is	 */	public void setMaxLine(int is, int xy) {		maxLine[xy] = is;	}	/**	 * @param is	 */	public void setMinLine(int is, int xy) {		minLine[xy] = is;	}		/**	 * @return	 */	public int getDrawnFrame() {		return drawnFrame;	}	/**	 * @param i	 */	public void setDrawnFrame(int i) {		drawnFrame = i;	}		public String toString()	{		SplitLine[] splits = { drawer.splitLine[AccordionDrawer.X], drawer.splitLine[AccordionDrawer.Y]};		return "X: " + (minLine[0]) + " -> " +			(maxLine[0]) + ", Y: " +			(minLine[1]) + " -> " +			(maxLine[1]);	}};

⌨️ 快捷键说明

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