int numAgents = 15000, agentShape = Agent.POINT; boolean done = false, pause = false, showGround = true, readFile = true, writeFile=false; boolean skip = false; // Fixes a bug in processing. Remove when bug fixed. boolean showTrampled = false, showinfo = true; boolean mousepause = false; int showinforows = 1; int showlabelmode = 0; boolean showPeople = false; String stadiumFile = "stadium.txt"; Writer agentWriter = null; boolean showHelpPanel = false; boolean logfile = false; boolean changeExit = true; boolean showlinegraph = true; boolean confusion = true; boolean fieldEgress = true; boolean recordimages = false; int agentheightKeys = 0; boolean writeAgents = false; int stopAtStep = 0; // turns on writing if > 0. boolean showNodeLabels = false; void keyPressed(){ if (showHelpPanel) { showHelpPanel = false; return; } boolean newNav = false; if(pause) loop(); if(key>='0' && key<='9') { int n = (key - '0'); if(n==0) n=10; numAgents = n*10000; setupGraph(newNav); return; } else { switch(key) { case '<': graph.halfAgentSpeeds(); return; case '>': graph.doubleAgentSpeeds(); return; case 'b': Node n = getClosestNodeToMouse(); graph.setOffBomb(n, ((readFile) ? 2 : 100)); // REMIND: Move scaling to FileGraph? return; case 'f': readFile = !readFile; newNav = true; setupGraph(newNav); return; case 'g': showGround = !showGround; return; case 'e': case 'E': fieldEgress = !fieldEgress; return; case 'i': showlabelmode = (showlabelmode>=3) ? 0 : showlabelmode+1; graph.setLabelState(showlabelmode); return; case 'l': //LOGGING logfile = !logfile; return; case 'h': case 'H': nav.reset(); return; case 'p': pause = !pause; if(pause) noLoop(); else loop(); return; case 't': case 'T': showTrampled = !showTrampled; return; case 'o': case 'O': showinfo = !showinfo; return; case '/': case '?': showHelpPanel = !showHelpPanel; return; case '=': showlinegraph = !showlinegraph; return; case 'z': case 'Z': showPeople = !showPeople; return; case 'c': case 'C': confusion = !confusion; setupGraph(newNav); return; case 'r': setupGraph(newNav); return; case 's': agentShape = (agentShape+1) % Agent.SHAPES; Agents.ask(new SetShape(agentShape)); return; case 'w': writeAgents = !writeAgents; setupGraph(newNav); return; case '[': showinforows = (showinforows>0)?showinforows-1:0; return; case ']': showinforows = (showinforows0)?agentheightKeys-1:0; agentheightKeys = agentheightKeys-1; agentheightKeys = (agentheightKeys<1)?1:agentheightKeys; return; case '}': //agentheightKeys = (agentheightKeys"); return; } } }