Package de.torstennahm.util

Examples of de.torstennahm.util.ColorScale


    super.paintComponent(g);
   
    int dim0, dim1;
    int mode = parent.modeBox.getSelectedIndex();
    int boxSize = getBoxSize();
    ColorScale colorScale = parent.getColorScale();
    double colorFactor = (10 - parent.colorFactorBar.getValue()) / 5.0;
    double colorOffset = parent.colorOffsetBar.getValue() / 10.0;
    int timeLimit = parent.timeBar.getValue();
   
    synchronized (this) {
      if (evaluator == null) {
        return;
      }
    }
   
    dim0 = parent.dim0Bar.getValue();
    dim1 = parent.dim1Bar.getValue();
   
    boolean calc = false;
   
    for (int i = 0; i < GridVisualizer.GRIDSIZE; i++) {
      for (int j = 0; j < GridVisualizer.GRIDSIZE; j++) {
        if (dim0 != dim1 || i == j) {
          Index index = new FastIndex();
          index = index.set(dim0, i);
          index = index.set(dim1, j);
         
          int[] pixel = positionToPixel(new int[] {i, j});
         
          EvalData data;
          synchronized (valueMap) {
            data = valueMap.get(index);
          }
          if (data == null) {
            calc = true;
          } else {
            double contribution = data.contribution;
            if (! Double.isNaN(contribution)) {
              double b = 0.0;
              double integrate = Math.abs(contribution);
              int evals = evaluator.pointsForIndex(index);
             
              if (mode == 0) {
                b = 0.7 - 0.7 * MathTN.log10(integrate) / MathTN.log10(MathTN.FUDGE);
              } else if (mode == 1) {
                b = 0.4 + 0.1 * MathTN.log10(evals);
              } else if (mode == 2) {
                b = 0.7 - 0.7 * MathTN.log10(integrate / evals) / MathTN.log10(MathTN.FUDGE);
              }
             
              g.setColor(colorScale.getColor((b + colorOffset) * colorFactor));
              g.fillRect(pixel[0], pixel[1], boxSize, boxSize);
//              if (contribution > 0) {
//                g.setColor(Color.BLACK);
//                g.fillRect(pixel[0] + (boxSize * 3) / 8, pixel[1] + (boxSize * 3) / 8, boxSize / 4, boxSize / 4);
//              }
View Full Code Here


   
    int dim0 = parent.dim0Bar.getValue();
    int dim1 = parent.dim1Bar.getValue();
    int timeLimit = parent.timeBar.getValue();
    double colorFactor = (10 - parent.colorFactorBar.getValue()) / 5.0;
    ColorScale colorScale = parent.getColorScale();
    int gridSize = GridVisualizer.GRIDSIZE;
   
    synchronized (parent.statusGrid) {
      for (int i = 0; i < gridSize; i++) {
        Arrays.fill(parent.statusGrid[i], null);
      }
    }
   
    for (int i = 0; i < gridSize; i++) {
      for (int j = 0; j < gridSize; j++) {
        if (dim0 != dim1 || i == j) {
          Index index = new FastIndex();
          index = index.set(dim0, i);
          index = index.set(dim1, j);
          List<StatusData> indexList;
          synchronized (lock) {
            indexList = statusMap.get(index);
         
            if (indexList != null) {
              DecimalFormat df = new DecimalFormat("0.###E0");
             
              int[] pos = new int[] { index.get(dim0), index.get(dim1) };
              int[] pixel = positionToPixel(pos);
             
              StringBuffer statusText = new StringBuffer();
              int statusCount = 0;
              for (StatusData statusData : indexList) {
                if (statusData.time <= timeLimit) {
                  IndexVisualizerData data = statusData.data;
                  if (data instanceof IndexContribution || data instanceof IndexContributionEstimate) {
                    double contribution;
                    if (data instanceof IndexContribution) {
                      contribution = ((IndexContribution) data).contribution;
                    } else {
                      contribution = ((IndexContributionEstimate) data).estimate;
                      statusText.append(" Estimate: " + df.format(((IndexContributionEstimate) data).estimate));
                    }
                   
                    double r = Math.abs(contribution);
                    double b = 0.7 - 0.7 * MathTN.log10(r) / MathTN.log10(MathTN.FUDGE);
                    g.setColor(colorScale.getColor(b * colorFactor));
                    if (data instanceof IndexContribution) {
                      g.fillRect(pixel[0], pixel[1], getBoxSize(), getBoxSize());
                    } else {
                      int size = getBoxSize();
                      g.fillRect(pixel[0] + size / 4, pixel[1] + size / 4, size / 2, size / 2);
View Full Code Here

TOP

Related Classes of de.torstennahm.util.ColorScale

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.