예제 #1
0
 public void setOflowColor(double frac) {
   int fc = cminfo.getFirstColor();
   int lc = cminfo.getLastColor();
   int color = (int) (fc + frac * (lc - fc) + 0.5);
   cminfo.setOflowColor(color);
   colorLookupTable.setOflowColor(color);
 }
예제 #2
0
  /**
   * Construct a Polyline that represents a graph of the Vs function.
   *
   * @param x0 The X-coordinate of the left side of the graph (pixels).
   * @param y0 The Y-coordinate of the top of the graph (pixels).
   * @param width The width of the graph (pixels).
   * @param height The height of the graph (pixels).
   */
  public Polyline getGraph(int x0, int y0, int width, int height) {
    if (!getCltUpToDate()) {
      updateLookupTable();
    }
    // if (graphX == x0 && graphY == y0 &&
    //    graphWidth == width && graphHeight == height)
    // {
    //    return curve;
    // }
    int i;
    int j;
    double ficol5 = cminfo.getFirstColor() - 0.5;
    int ncols = cminfo.getNumColors();
    double fncols = ncols;
    double fh1 = height - 1;
    double fw1 = width - 1;
    int[] tbl = colorLookupTable.getTable();
    int tsize = tbl.length;
    double ftsize = tsize;

    // Need 2 pts on each color.  In worst case, lookup
    // table could change color with every table entry.
    Polyline curve = new Polyline(tsize * 2);
    int[] x = curve.x;
    int[] y = curve.y;

    int col = tbl[0];
    x[0] = x0;
    y[0] = y0 + (int) (fh1 - fh1 * (col - ficol5) / fncols + 0.5);
    for (i = j = 1; i < tsize; i++) {
      if (tbl[i] != col) {
        x[j] = x0 + (int) ((fw1 * i) / ftsize + 0.5);
        y[j] = y[j - 1];
        j++;
        col = tbl[i];
        x[j] = x[j - 1];
        y[j] = y0 + (int) (fh1 - fh1 * (col - ficol5) / fncols + 0.5);
        j++;
      }
    }
    x[j] = x0 + width - 1;
    y[j] = y[j - 1];
    curve.length = j + 1;
    if (cminfo.getNegative()) {
      for (i = 0; i < curve.length; i++) {
        y[i] = height - y[i];
      }
    }
    return curve;
  }
예제 #3
0
 public void setMaxData(double maxval) {
   colorLookupTable.maxData = maxval;
 }
예제 #4
0
 public void setMinData(double minval) {
   colorLookupTable.minData = minval;
 }