Changeset 1799


Ignore:
Timestamp:
11/15/06 18:24:26 (14 years ago)
Author:
chris
Message:

browser:
1) made color mixing work for large datasets where
each pixel of the CacheIndicator has to represent
several different entries in the cache. Mixes Red
with Blue to the appropriate amount, indicating
how much is loaded, how much is loading.

Location:
trunk/loci/plugins/browser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/plugins/browser

    • Property svn:ignore
      •  

        old new  
        11*.class 
        22TestMixing.java 
         3IndicatorTest.java 
        34IJ_Prefs.txt 
  • trunk/loci/plugins/browser/CacheIndicator.java

    r1791 r1799  
    5959    g.setColor(Color.black); 
    6060    g.drawRect(0,0,getWidth()-1,COMPONENT_HEIGHT - 1); 
    61 //    System.out.println("Ratio = " + ratio); 
     61 
    6262    if(ratio < 1) { 
     63      int [] loadColor = new int[getWidth()]; 
     64      int [] cacheColor = new int[getWidth()]; 
     65       
     66      for(int i = 0;i < loadColor.length;i++) { 
     67        loadColor[i] = -1; 
     68        cacheColor[i] = -1; 
     69      } 
     70       
     71      //find how many entries of the cache are handled per pixel of indicator 
     72      int perPixel; 
     73      double integers = 2; 
     74      double dPerPixel = ratio * integers;   
     75       
     76      System.out.println("Ratio: " + ratio); 
     77      while(dPerPixel < 1) { 
     78        integers++; 
     79        dPerPixel = ratio * integers; 
     80      } 
     81       
     82      Double temp = new Double(integers); 
     83      perPixel = temp.intValue(); 
     84       
     85      System.out.println("PerPixel: " + perPixel); 
     86       
     87      int colorAmount = 255 / perPixel; 
     88      System.out.println("ColorAmount: " + colorAmount); 
     89       
     90      for(int i = 0;i<loadList.length;i++) { 
     91        int index = translate(loadList[i]); 
     92        if (loadColor[index] == -1) loadColor[index] = 0; 
     93        loadColor[index] = loadColor[index] + colorAmount; 
     94        if (loadColor[index] > 255) { 
     95          System.out.println("RED: " + loadColor[index]); 
     96          loadColor[index] = 255; 
     97        } 
     98      } 
     99      for(int i = 0;i<cache.length;i++) { 
     100        int index = translate(cache[i]); 
     101        if (cacheColor[index] == -1) cacheColor[index] = 0; 
     102        cacheColor[index] = cacheColor[index] + colorAmount; 
     103        if (cacheColor[index] > 255) { 
     104          System.out.println("BLUE: " + cacheColor[index]); 
     105          cacheColor[index] = 255; 
     106        } 
     107      } 
     108       
     109      for(int i = 0;i < getWidth();i++) { 
     110        if(loadColor[i] != -1 || cacheColor[i] != -1) { 
     111          if(loadColor[i] == -1) loadColor[i] = 0; 
     112          if(cacheColor[i] == -1) cacheColor[i] = 0; 
     113          g.setColor(new Color(loadColor[i],0,cacheColor[i])); 
     114          g.drawLine(i,1,i,COMPONENT_HEIGHT - 2); 
     115        } 
     116        else continue; 
     117      } 
    63118    } 
    64119    else { 
     
    80135          int x = translate(startLoad); 
    81136          int wid = translate(prevLoad) - x; 
    82 //          System.out.println("Rectangle: x = " + x + "; width = " + wid); 
    83137          g.fillRect(x,1,wid,COMPONENT_HEIGHT - 2); 
    84138          startLoad = -1; 
  • trunk/loci/plugins/browser/CacheManager.java

    r1791 r1799  
    5858 
    5959  /** Flags debug messages on/off.*/ 
    60   public static final boolean DEBUG = true; 
     60  public static final boolean DEBUG = false; 
    6161 
    6262  // -- Fields -- 
Note: See TracChangeset for help on using the changeset viewer.