Пример #1
0
 public void drawLines(int it, int runnum) {
   for (int i = lastDrawn; i < runnum; i++) {
     for (int yy = 1; yy < it; yy++) {
       CApicture.drawALine(savedvals[i][yy - 1], yy - 1, savedvals[i][yy], yy, javaColours[1]);
     }
   }
   lastDrawn = runCount;
   CApicture.updateGraphic();
 }
Пример #2
0
  public void initialise() {
    experiment = new CAGridStatic(gSize, maxit, dsize);

    // change call to setScale if just using 1 image
    if (runCount < 1) {
      CApicture.setScale(gSize, maxit, scale, gSize, rowstoDraw, scale);
      CApicture.clearCAPanel(1);
      CApicture.clearCAPanel(2);
    }
    iterations = 0;
  }
Пример #3
0
  public void drawLines() {

    if (iterations > 0) {
      CApicture.drawALine(
          experiment.savedx[iterations - 1],
          iterations - 1,
          experiment.savedx[iterations],
          iterations,
          javaColours[1]);
      CApicture.updateGraphic();
    }
  }
Пример #4
0
 public void drawCA() {
   int a;
   // CApicture.clearCAPanel();
   for (CACell c : experiment.tissue) {
     a = c.lineage;
     if (a > 0) a = (a - 1) % nnw + 1;
     // if(a<7){
     CApicture.drawCircleAt(c.home.x, iterations, javaColours[a]);
     // }else{
     // CApicture.drawCircleAt(c.home.x,iterations,Color.orange);
     // }
   }
   CApicture.updateGraphic();
 }
Пример #5
0
  public CAStatic(int size) {

    // size is the size of the area containing cells
    dsize = size;
    gSize = size + 2 * maxit;
    int wscale = 6; // scale for main panel
    int btnHeight = 480 - 384; // found by trial and error - must be a better way!

    // experiment = new CAGridStatic(size, maxC);
    // int tint = (int)Math.ceil((double)(400*maxit)/(double)gSize)+(480-384);
    // int tint = (int)Math.ceil((double)(400*(50+maxit))/(double)gSize)+(480-384);
    int tint = (maxit + rowstoDraw) * wscale + btnHeight;
    // only going to show up to 50 dots in lower panel
    // add 20 to x and 60 to y bcos not printing onto the full frame
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container mainWindow = getContentPane();
    mainWindow.setLayout(new BorderLayout());
    setSize(gSize * wscale, tint);

    buttonHolder = new JPanel();
    buttonHolder.setLayout(new GridLayout(2, 2));

    SpinnerNumberModel model3 = new SpinnerNumberModel(50, 0, 100, 5);
    JSpinner spinner3 = new JSpinner(model3);
    writeBtn = new JButton("Output Results to file");
    writeBtn.addActionListener(this);

    startBtn = new JButton("Start");
    startBtn.addActionListener(this);

    paramsBtn = new JButton("Set Probabilities");
    paramsBtn.addActionListener(this);

    wrapBtn = new JButton("Toggle wrap");
    wrapBtn.addActionListener(this);

    buttonHolder.add(writeBtn);
    writeBtn.setVisible(false);
    buttonHolder.add(paramsBtn);
    buttonHolder.add(wrapBtn);
    buttonHolder.add(startBtn);

    mainWindow.add(buttonHolder, BorderLayout.SOUTH);

    msgBtn = new JTextArea(" Default Parameter Values: " + CAGridStatic.params);
    msgBtn.setEditable(false);

    mainWindow.add(msgBtn, BorderLayout.NORTH);

    CApicture = new CAImagePanel();
    CApicture.rowstoShow = rowstoDraw;
    mainWindow.add(CApicture, BorderLayout.CENTER);

    // not here - doesn't work: CApicture.setScale(gSize,maxit,scale);

    // pack();

    setVisible(true);
    setpalette();
    iterations = 0;
    savedvals = new int[maxRun][maxit];
    outPrinter = new ResultsPrinter(this);
  }
Пример #6
0
 public void drawCount(int ind) {
   CApicture.drawCircleAt(ind, dCount[ind], javaColours[1], 2);
   CApicture.updateGraphic();
 }