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

📄 accordiondrawer.java

📁 生物物种进化历程的演示
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
//		glj.gljFree();				}	/**		* render lens in a special mode		* readPixels form the front buffer in x and y direction		* to avoid flickering and overwrite only diffPos in x and y		* 		* to render the lens do a twolinesmove with picked cells		* render the solution in a small viewport in the back buffer		* read pixels of this viewport 		* switch back in the original viewport 		* draw stored pixels		* 		* TODO: x-distortion, check boundaries, flowmenu like zooming		* 			* 		*@author Kristian Hildebrand		*/		public void doLens() {//			// //			double a = 0.45f;// minStuckVal[X];//			double b = 0.55f;// maxStuckVal[X];//			int pos[] = new int[2];//			int diffPos[] = new int[2];//			int drawPos[] = new int[2];//			int drawSize[] = new int[2];//		//			if (null == glj || !glj.gljMakeCurrent())//				return;////			//System.out.println("lens at work... ");//			if(!justPressed){//			//				gl.glDrawBuffer(GL_FRONT_AND_BACK);//				gl.glDepthMask(false);//					//				// difference between mousepos between frames//				diffPos[X] = lens.pos[X] - lens.oldPos[X];//				diffPos[Y] = lens.pos[Y] - lens.oldPos[Y];//				// divide four different cases to decide which pixels //				// on the x and y side have to be 'reconstructed' after//				// the lens is moved//				if(diffPos[Y] < 0) {					//					//System.out.println("y less ");//					for(int i = 0; i <= Math.abs(diffPos[Y]); i++) {//						gl.glRasterPos3d(s2w(lens.oldPos[X] - lens.size[X]/2, X), s2w(lens.oldPos[Y] + lens.size[Y]/2 - i, Y), labelplane );//						gl.glDrawPixels(lens.size[X], 1, gl.GL_RGB, gl.GL_FLOAT, xlenspixels[i]);//					}//				}//				if(diffPos[Y] >= 0){	//					//System.out.println("y more");				//					for(int i = 0; i <= Math.abs(diffPos[Y]); i++){//						gl.glRasterPos3d(s2w(lens.oldPos[X] - lens.size[X]/2, X), s2w(lens.oldPos[Y] - lens.size[Y]/2 + i, Y), labelplane );//						gl.glDrawPixels(lens.size[X], 1, gl.GL_RGB, gl.GL_FLOAT, xlenspixels[lens.size[Y] - i]);//					}//				}//				if(diffPos[X] < 0) {	//					//System.out.println("x less");				//					for(int i = 0; i <= Math.abs(diffPos[X]); i++){//						gl.glRasterPos3d(s2w(lens.oldPos[X] + lens.size[X]/2 - i, X), s2w(lens.oldPos[Y] + lens.size[Y]/2, Y), labelplane );//						gl.glDrawPixels(1, lens.size[Y], gl.GL_RGB, gl.GL_FLOAT, ylenspixels[lens.size[X] - i]);//					}//				}//				if(diffPos[X] >= 0){	//					//System.out.println("x more");				//					for(int i = 0; i <= Math.abs(diffPos[X]); i++){//						gl.glRasterPos3d(s2w(lens.oldPos[X] - lens.size[X]/2 + i, X), s2w(lens.oldPos[Y] + lens.size[Y]/2, Y), labelplane );//						gl.glDrawPixels(1, lens.size[Y], gl.GL_RGB, gl.GL_FLOAT, ylenspixels[i]);//					}//				}//			//			}//		//			// read the pixels in two different ordered arrays //			// to make the buffer assgnment easier //			// it is not very performant //			gl.glReadBuffer(gl.GL_BACK);				//			for(int i=0; i <= lens.size[Y]; i++){//				gl.glReadPixels(lens.min[X], winsize[Y] -  lens.max[Y] + i, lens.size[X], 1 , gl.GL_RGB, gl.GL_FLOAT, xlenspixels[i]);//			}//			for(int i=0; i <= lens.size[X]; i++){//				gl.glReadPixels(lens.min[X] + i, winsize[Y] -  lens.max[Y], 1, lens.size[Y], gl.GL_RGB, gl.GL_FLOAT, ylenspixels[i]);//			}	//			// decide what to read if the land is outside//		//			// do a two lines move of the two cells you picked//			//expandleaves = -1;//			//resetGridUniform();//				//			twoLinesMove(Y, lens.minc[Y], a, lens.maxc[Y], b );//			twoLinesMove(X, lens.minc[X], a , lens.maxc[X] , b);//		//		//			// change to a smaller viewport depending on the lens size//			// do not use a reshape here b/c this changes the winsize//			int gridMax = gridDepth[0] > gridDepth[1] ? gridDepth[0] : gridDepth[1];//				//			//gl.glDrawBuffer(GL_BACK);//			gl.glViewport(lens.min[X],  winsize[Y] - lens.max[Y], lens.size[X], lens.size[Y]);//			gl.glMatrixMode(GL_PROJECTION);//			gl.glLoadIdentity();//			gl.glOrtho(0.0f, 1.0f, 0.0f, 1.0f, .01f, gridMax + 4.0f);//			gl.glScalef(1.0f, -1.0f, 1.0f);//			gl.glTranslatef(0.0f, -1.0f, 0.0f);//			gl.glMatrixMode(GL_MODELVIEW);//			gl.glLoadIdentity();////			// start a new Frame to make changes visible//			startNewFrame();//			//			// read what you've done//			gl.glReadBuffer(gl.GL_BACK);//		//			gl.glReadPixels(lens.min[X], winsize[Y] - lens.max[Y], lens.size[X], lens.size[Y], gl.GL_RGB, gl.GL_FLOAT, zoompixels);//		//			// unfortunately I have to decide what size to read to get a good working lens//			// even at the boundaries//			gl.glReadPixels(lens.min[X], winsize[Y] - lens.max[Y], lens.size[X], lens.size[Y], gl.GL_RGB, gl.GL_FLOAT, zoompixels);//		//		//			// switch back to the original viewport//			gl.glViewport(0,0, winsize[X], winsize[Y]);//			gl.glMatrixMode(GL_PROJECTION);//			gl.glLoadIdentity();//			gl.glOrtho(0.0f, 1.0f, 0.0f, 1.0f, .01f, gridMax + 4.0f);//			gl.glScalef(1.0f, -1.0f, 1.0f);//			gl.glTranslatef(0.0f, -1.0f, 0.0f);//			gl.glMatrixMode(GL_MODELVIEW);//			gl.glLoadIdentity();//		//			// undo the two lines move using the stored temp variables //			// stored in updateLens() //		//	System.out.println("Splitpos prev " + lens.temp_min[X]);		//			twoLinesMove(X, lens.minc[X], lens.temp_min[X], lens.maxc[X], lens.temp_max[X]);//			twoLinesMove(Y, lens.minc[Y], lens.temp_min[Y], lens.maxc[Y], lens.temp_max[Y]);//		//		//	System.out.println("Splitpos real " + lens.minc[X].getSplitPos(X, false));//		//			//expandleaves = 1;//			//resetGridUniform();//		//			// 	start a new Frame to make changes visible	//			startNewFrame();//			//expandLeaves(1);//			// draw the lens on the front buffer//			gl.glDrawBuffer(GL_FRONT);//			glc.setDoubleBuffered(false);//			gl.glDepthMask(false);//			gl.glDepthFunc(GL_ALWAYS);//			gl.glRasterPos3d(s2w(lens.min[X], X), s2w(lens.max[Y], Y), labelplane );//			gl.glDrawPixels(lens.size[X], lens.size[Y], gl.GL_RGB, gl.GL_FLOAT, zoompixels);			//		//			gl.glFlush();//			glj.gljFree();//// 			}	/**	 * Helper function for {@link #doDrawFrame doDrawFrame} to move	 * grid lines during animated transitions. 	 *	 * First, all objects that are moved (i.e., GridCells resized) go	 * through a gradual animated transition. Of course the rest of	 * the cells are all shrunk or expanded by the same ratio to	 * accomodate these transitions. 	 * @author   Tamara Munzner, Serdar Tasiran	 * @see      AccordionDrawer.GridCell	 */	protected void doFrameMove() {	keepMoving = false;		if (toMove.size() > 0) {		transitionAnimating = true;//		requestRedrawEventually();		Enumeration enum = toMove.elements();		while (enum.hasMoreElements()) {		SplitTransition st = (SplitTransition)enum.nextElement();//		if (st.getDrawer() != this)//			System.out.println("What???");		st.incr();		if (st.done()) {			toMove.remove(st.getHashKey());			if (toMove.size() < 1)			{				transitionAnimating = false;				break;			} 		} else {			st.move();			keepMoving = true;		}		}	}	}    public void setDynamicFrameTime(long milliseconds) {dynamicTime = milliseconds;}    public int getFrameNum() { return frameNum;}    public Color getBackgroundColor() { return backgroundColor; }    public Color getLabelColor() { return labelColor; }    public Color getLabelBackColor() { return labelBackColor; }    public Color getLabelHiColor() { return labelHiColor; }    public Color getLabelBackHiColor() { return labelBackHiColor; }    public Color getRubberbandColor() { return rubberbandColor; }    public void setBackgroundColor(Color backgroundColor) { this.backgroundColor = backgroundColor;}    public void setLabelColor(Color labelColor) { this.labelColor = labelColor;}    public void setLabelBackColor(Color labelBackColor) { this.labelBackColor = labelBackColor;}    public void setLabelHiColor(Color labelHiColor) { this.labelHiColor = labelHiColor;}    public void setLabelBackHiColor(Color labelBackHiColor) { this.labelBackHiColor = labelBackHiColor;}    public void setRubberbandColor(Color rubberbandColor) { this.rubberbandColor = rubberbandColor;}    public void setNumAnimSteps(int numAnimSteps) { this.numAnimSteps = numAnimSteps; }    public int getNumAnimSteps() { return numAnimSteps; }    public void setInflateIncr(double value) { inflateIncr = value;}    public double getInflateIncr() { return inflateIncr; }    public void setFlash(CellGeom cg, Color col, int x, int y, boolean doBox) {//	System.out.println("setflash start" + x + " " + y);	flashGeom = cg;	flashCol = col;	flashX = x;	flashY = y;	this.doBox = doBox;	doFlash();//	System.out.println("setflash stop" + x + " " + y);    }	protected void setHighlightPlane(float w)	{	  	hiliteplane = w;			}	protected void resetHighlightPlane()	{			hiliteplane = -0.3f;			}	protected void setObjectPlane(float w)	{		objplane = w;			}		protected void resetObjectPlane()		{			objplane = -.5f; 		}	    public void setFocusCell(GridCell fc) {focusCell = fc;}    public boolean getBigGrid() {return biggrid;}    public void setBigGrid(boolean on) {biggrid = on; requestRedraw();}    public void toggleBigGrid() {setBigGrid(!biggrid);}    public boolean getCacheRange() {return cacherange;}    public void setCacheRange(boolean on) {	cacherange = on;	if (dumpstats) {	    stats.println();	    stats.println("CACHERANGE: "+cacherange);	}    }    public void toggleCacheRange() {setCacheRange(!cacherange);}    public boolean getCheckTime() {return checktime;}    public void setCheckTime(boolean on) {	checktime = on; 	if (dumpstats) {	    stats.println(); 	    stats.println("CHECKTIME: "+checktime);	}    }    public void toggleCheckTime() {setCheckTime(!checktime);}    public boolean getColorGrid() {return colorgrid;}    public void setColorGrid(boolean on) {colorgrid = on; requestRedraw();}    public void toggleColorGrid() {setColorGrid(!colorgrid);}    public boolean getDimBrite() {return dimbrite;}    public void setDimBrite(boolean on) {dimbrite = on; requestRedraw();}    public void toggleDimBrite() {setDimBrite(!dimbrite);}    public boolean getDimColors() {return dimcolors;}    public void setDimColors(boolean on) {dimcolors = on; requestRedraw();}    public void toggleDimColors() {setDimColors(!dimcolors);}    public boolean getDrawLabels() {return drawlabels;}    public void setDrawLabels(boolean on) {drawlabels = on; requestRedraw();}    public void toggleDrawLabels() {setDrawLabels(!drawlabels);}    public int getDrawOrder() {return draworder;}    public void setDrawOrder(int order) {	draworder = order;	if (dumpstats) {	    stats.println();	    stats.println("DRAWORDER: "+draworder);	}    }    public void toggleDrawOrder() {	draworder++;	if (draworder > FROMFOCUSCELL) draworder = BRUTEFORCE;	setDrawOrder(draworder);    }    public boolean getDumpStats() {return dumpstats;}    public void setDumpStats(boolean on) {	dumpstats = on; 	if (on) {	    try {		String fname = "stats"+key+"."+System.currentTimeMillis();		stats = new PrintWriter(new BufferedWriter(new FileWriter(fname)));	    } catch (IOException  e) {		System.out.println("can't open benchmark file: stats");	    }	} else {	    stats.flush();	    stats.close();	}    }    public void toggleDumpStats() {setDumpStats(!dumpstats);}    public int getExpandLeaves() {return expandleaves;}    public void toggleExpandLeaves() {	expandleaves++;	if (expandleaves > 1) expandleaves = -1;	setExpandLeaves(expandleaves, true);    }    public void setExpandLeaves(int expand, boolean redraw) {	expandleaves = expand;	resetGridUniform();	if (redraw)		requestRedraw();    }    public boolean getGuarVis() {return guarvis;}    public void setGuarVis(boolean on) {guarvis = on; requestRedraw();}    public void toggleGuarVis() {setGuarVis(!guarvis);}    public boolean getLabelDrawBack() {return labeldrawback;}    public void setLabelDrawBack(boolean on) {labeldrawback = on; requestRedraw();}    public void toggleLabelDrawBack() {setLabelDrawBack(!labeldrawback);}    public boolean getLabelPopup() {return labelpopup;}    public void setLabelPopup(boolean on) {labelpopup = on;}    public void toggleLabelPopup() {setLabelPopup(!labelpopup);}    public boolean getLabelPosRight() {return labelposright;}    public void setLabelPosRight(boolean on) {labelposright = on; requestRedraw();}    public void toggleLabelPosRight() {setLabelPosRight(!labelposright);}    public boolean getLabelTransp() {return labeltransp;}    public void toggleLabelTransp() {setLabelTransp(!labeltransp);}        public void setLabelTransp(boolean on) {    	// please don't use bleding for now    	// could fuck up rendering state under one of the platforms    }    public int getLineThickness() {return linethickness;}    public void setLineThickness(int thickness) {	linethickness = thickness;	if (linethickness < 1) linethickness = 1;//	System.out.println("lt "+linethickness);	requestRedraw();    }    public void increaseLineThickness() {setLineThickness(linethickness+1);}    public void decreaseLineThickness() {setLineThickness(linethickness-1);}    public boolean getLinkedNav() {return linkednav;}    public void setLinkedNav(boolean on) {linkednav = on;}    public void toggleLinkedNav() {linkednav = !linkednav;}    public boolean getNoFlash() {return noflash;}    public void setNoFlash(boolean on) {noflash = on; requestRedraw();}    public void toggleNoFlash() {setNoFlash(!noflash);}    public boolean getNoGeoms() {return nogeoms;}    public void setNoGeoms(boolean on) {nogeoms = on; requestRedraw();}    public void toggleNoGeoms() {setNoGeoms(!nogeoms);}    public boolean getNoGrid() {return nogrid;}    public void setNoGrid(boolean on) {nogrid = on; requestRedraw();}    public void toggleNoGrid() {setNoGrid(!nogrid);}    public boolean getShowAlg() {return showalg;}    public void setShowAlg(boolean on) {    	boolean originalDoubleBuffer = doublebuffer;	showalg = on;

⌨️ 快捷键说明

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