Changeset 1995


Ignore:
Timestamp:
01/02/07 17:25:46 (13 years ago)
Author:
sorber
Message:

Began working on transient box for selecting multiple overlays.

Location:
trunk/loci/visbio/overlays
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/visbio/overlays/OverlayTransform.java

    r1873 r1995  
    107107  protected int[] clipboardPos = null; 
    108108 
     109  /** Transient Select Box, if active */ 
     110  protected TransientSelectBox selectBox; 
     111 
    109112  // -- Constructor -- 
    110113 
     
    157160  /** Removes selected overlay objects at the current dimensional position. */ 
    158161  public void removeSelectedObjects() { removeSelectedObjects(pos); } 
     162 
     163  /** Adds a transient selection box. */  
     164  public void addTSB (TransientSelectBox tsb) { selectBox = tsb; } 
     165 
     166  /** Removes transient selection box. */ 
     167  public void removeTSB () { selectBox = null; } 
    159168 
    160169  /** Removes selected overlay objects at the given dimensional position. */ 
     
    514523        if (size > 0) { 
    515524          // compute number of selected objects and number of text objects 
    516           int rgbSize = 0, txtSize = 0, sel = 0, outline = 0; 
     525          int rgbSize = 0, txtSize = 0, sel = 0, outline = 0, tsb = 0; 
     526          if (selectBox != null) tsb = 1;  
    517527          for (int i=0; i<size; i++) { 
    518528            OverlayObject obj = (OverlayObject) overlays[q].elementAt(i); 
     
    531541            FunctionType fieldType = new FunctionType(index, 
    532542              new FunctionType(getDomainType(), getRangeType())); 
    533             GriddedSet fieldSet = new Integer1DSet(rgbSize + sel + outline); 
     543            GriddedSet fieldSet = new Integer1DSet(rgbSize + sel + outline + tsb); 
    534544            rgbField = new FieldImpl(fieldType, fieldSet); 
    535545            // compute overlay data for each non-text object 
     
    551561              rgbField.setSample(rgbSize + sel + c++, 
    552562                obj.getSelectionGrid(true), false); 
     563            } 
     564            // compute visual data for selectBox 
     565            if (selectBox != null) { 
     566              rgbField.setSample(rgbSize + sel + outline, selectBox.getData(), false); 
    553567            } 
    554568          } 
  • trunk/loci/visbio/overlays/PointerTool.java

    r1390 r1995  
    3838  protected float grabX, grabY; 
    3939 
     40  /** Location where mouseDown occurs */ 
     41  protected float downX, downY;  
     42 
     43  /** Selection box */ 
     44  protected TransientSelectBox select; 
     45 
    4046  // -- Constructor -- 
    4147 
     
    5258    boolean ctrl = (mods & InputEvent.CTRL_MASK) != 0; 
    5359 
     60    // record location of click 
     61    downX = x; 
     62    downY = y; 
     63 
     64    // instantiate selection box 
     65    select = new TransientSelectBox(overlay, downX, downY); 
     66    overlay.addTSB (select); 
     67  
    5468    // pick nearest object 
    5569    OverlayObject[] obj = overlay.getObjects(pos); 
     
    98112      overlay.setTextDrawn(true); 
    99113      overlay.notifyListeners(new TransformEvent(overlay)); 
     114    } else { 
     115      select = null; 
     116      overlay.removeTSB(); 
     117      overlay.notifyListeners(new TransformEvent(overlay)); 
    100118    } 
    101119  } 
     
    116134      grabY = y; 
    117135      overlay.notifyListeners(new TransformEvent(overlay)); 
     136    } else if (x != downX && y != downY) { 
     137      // extend selection box 
     138      select.setCorner (x, y); 
     139      overlay.notifyListeners(new TransformEvent(overlay)); 
    118140    } 
    119141  } 
    120  
    121142} 
Note: See TracChangeset for help on using the changeset viewer.