package uk.ac.leeds.ccg.cluster; // Main class for GAM/K // // J R Davy // Jan 1998. import java.io.*; import java.applet.*; import java.awt.*; import java.awt.event.*; import uk.ac.leeds.ccg.geotools.*; public class Gamk extends SimpleMethod implements Constants ,Method, Runnable { // Members private StreamTokenizer strTok; private BufferedReader input; private PrintWriter output; private Button data_button, par_button, clear_button; Viewer v = new Viewer(); Label Rad = new Label("Radius: 00.00"); Results res = new Results(); GamButtonHandler hand; GamSearch gsearch; CircleLayer cl = new CircleLayer(); GeoRectangle rec=null; Database dbase; Shader sh; GamParameters pars = new GamParameters(); GamParametersViewer pv = new GamParametersViewer(pars); // Constructors public Gamk() {} // Methods public Results getResults(){return res;} public String toString() {return "Gamk";} public void setViewer(Viewer vw) {v=vw;} public void setSearch(GeoRectangle r) {rec=r;} public Parameters getParameters() {return pars;} public ParametersViewer getParametersViewer() {return pv;} public void setShader(Shader s){ sh=s; if(gsearch!=null) gsearch.addShader(s); } public void setData(Database d) {dbase=d;} public void run(){ SignificanceTest sigTest=significanceTest; gsearch = new GamSearch(dbase, pars); if(gsearch!=null) gsearch.addShader(sh); gsearch.addRadLabel(Rad); if(sigTest==null){ System.out.println("Gam null sig test - using Poission"); sigTest = new PoissonTest(); sigTest.setParameters(pars); } gsearch.setSignificanceTest(sigTest); //Thread t = new Thread(gsearch); //t.start(); if(rec==null) rec=dbase.getBounds(); gsearch.run(listeners,rec); res = gsearch.getResults(); //v.setAnimationTheme(null); } public void paint(Graphics g){ g.drawString("Geographical Analysis Machine (Oct 1997)", 25, 25); g.drawString("Copyright Stan Openshaw, Univ. of Leeds", 25, 40); String argv[] = {"gam.files","gam.par"}; } public void init(){ /* data_button = new Button("database"); data_button.setForeground(Color.black); data_button.setBackground(Color.gray); this.add(data_button); par_button = new Button("parameters"); par_button.setForeground(Color.black); par_button.setBackground(Color.gray); this.add(par_button); clear_button = new Button("cleanup"); clear_button.setForeground(Color.black); clear_button.setBackground(Color.gray); this.add(clear_button); */ } /* private void clear() { Graphics g = this.getGraphics(); Rectangle r = this.bounds(); g.setColor(this.getBackground()); g.fillRect(r.x,r.y,r.width,r.height); g.setColor(this.getForeground()); } */ /* public boolean action(Event event, Object arg) { if(event.target == data_button) { clear(); Graphics g = this.getGraphics(); g.drawString("Got database", 25, 125); return true; } else if(event.target == par_button) { clear(); Graphics g = this.getGraphics(); g.drawString("Set parameters", 25, 125); return true; } else if (event.target == clear_button) { clear(); return true; } else return super.action(event, arg); } */ }