Changeset 524


Ignore:
Timestamp:
10/10/05 15:48:14 (15 years ago)
Author:
curtis
Message:

Eliminate ugly status messages with ImageRendererJ3D and volume rendering.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/visbio/view/StackLink.java

    r520 r524  
    4141  // -- Constants -- 
    4242 
    43   /** Dummy data to avoid "Data is null" status messages. */ 
    44   protected static final Real DUMMY = new Real(0); 
    45  
     43  /** Dummy data to avoid "Data is null" message for volume reference. */ 
     44  protected static final Data DUMMY = new Real(0); 
     45   
    4646 
    4747  // -- Fields -- 
     
    8282  protected int currentSlice; 
    8383 
    84   /** Flags indicating visibility of each slice of the stack. */ 
     84  /** 
     85   * Flags indicating visibility of each slice of the stack. 
     86   * Used for both initial state and temporary storage while volume rendering. 
     87   */ 
    8588  protected boolean[] visSlices; 
    8689 
     
    180183    if (this.volume == volume) return; 
    181184    this.volume = volume; 
     185    if (volume) { 
     186      // save slice visibility settings and hide slice data 
     187      int len = renderers.size(); 
     188      visSlices = new boolean[len]; 
     189      for (int s=0; s<len; s++) { 
     190        DataRenderer sliceRend = (DataRenderer) renderers.elementAt(s); 
     191        visSlices[s] = sliceRend.getEnabled(); 
     192        sliceRend.toggle(false); 
     193      } 
     194    } 
     195    else { 
     196      // restore slice visibility settings 
     197      int len = renderers.size(); 
     198      boolean all = visSlices == null || visSlices.length != len; 
     199      for (int s=0; s<len; s++) { 
     200        DataRenderer sliceRend = (DataRenderer) renderers.elementAt(s); 
     201        sliceRend.toggle(all ? true : visSlices[s]); 
     202      } 
     203    } 
    182204    doTransform(TransformHandler.MINIMUM_BURN_DELAY, true); 
    183205  } 
     
    434456 
    435457        //Real zreal = new Real(zbox, zval, zunit, null); 
    436         zval = 2 * zval / (getSliceCount() - 1) - 1; 
    437         ConstantMap zmap = new ConstantMap(zval, Display.ZAxis); 
    438         dataRend.getLinks()[0].setConstantMaps(new ConstantMap[] {zmap}); 
     458        int numSlices = getSliceCount(); 
     459        if (numSlices > 1) { 
     460          zval = 2 * zval / (getSliceCount() - 1) - 1; 
     461          ConstantMap zmap = new ConstantMap(zval, Display.ZAxis); 
     462          dataRend.getLinks()[0].setConstantMaps(new ConstantMap[] {zmap}); 
     463        } 
    439464      } 
    440465      catch (VisADException exc) { exc.printStackTrace(); } 
     
    549574          } 
    550575        } 
    551         if (volume) setData(DUMMY, sliceRef, false); 
    552         else setData(slices[s], sliceRef, sliceRend, true, s); 
     576        if (!volume) setData(slices[s], sliceRef, sliceRend, true, s); 
    553577      } 
    554578    } 
Note: See TracChangeset for help on using the changeset viewer.