Changeset 2096


Ignore:
Timestamp:
01/15/07 15:00:41 (13 years ago)
Author:
curtis
Message:

Fix most lines greater than 80 chars.

Location:
trunk/loci/visbio/overlays
Files:
7 edited

Legend:

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

    r2095 r2096  
    3434  // -- Constants -- 
    3535 
    36   /** When drawing or editing, how far mouse must be dragged before new node is added */ 
     36  /** 
     37   * When drawing or editing, how far mouse 
     38   * must be dragged before new node is added. 
     39   */ 
    3740  protected static final double DRAW_THRESH = 2.0; 
    38   /** Threshhold within which click must occur to invoke edit mode */ 
     41 
     42  /** Threshhold within which click must occur to invoke edit mode. */ 
    3943  protected static final double EDIT_THRESH = 5.0; 
    40   /** Threshhold within which click must occur to invoke extend mode or reconnect a tendril */ 
     44 
     45  /** 
     46   * Threshhold within which click must occur to 
     47   * invoke extend mode or reconnect a tendril. 
     48   */ 
    4149  protected static final double RECONNECT_THRESH = 0.5; 
    4250 
    43   /** 4 constants describing edit modes */ 
    44   // There are four edit modes.  The method setMode(int) is called to change the mode, in order to 
    45   // properties related to the current mode; e.g., whether a freeform is selected in the list of 
    46   // overlays 
     51  /** Constant for "erase" edit mode. */ 
    4752  protected static final int ERASE = -1; 
     53 
     54  /** Constant for "chill" edit mode. */ 
    4855  protected static final int CHILL = 0; // could call this WAIT... 
     56 
     57  /** Consant for "draw" edit mode. */ 
    4958  protected static final int DRAW = 1; 
     59 
     60  /** Constant for "edit" edit mode. */ 
    5061  protected static final int EDIT = 2; 
    5162 
     
    207218  } 
    208219 
    209   /** Splits the node array into two parts.  The first part goes from a[0] to a[index-1], the second 
    210     * from a[index2] to a[a.length -1] */ 
    211   private void splitNodes (int index, int index2) { 
     220  /** 
     221   * Splits the node array into two parts.  The first part goes from a[0] to 
     222   * a[index-1], the second from a[index2] to a[a.length -1]. 
     223   */ 
     224  private void splitNodes(int index, int index2) { 
    212225    // splits the array a into two (before the index specified) 
    213226    float[][] a = freeform.getNodes(); 
     
    243256  } 
    244257 
    245   /** Sets variables related to edit mode */ 
     258  /** 
     259   * Changes the edit mode. Depending on the new mode, some properties may 
     260   * change: e.g., whether a freeform is selected in the list of overlays. 
     261   */ 
    246262  private void setMode(int newMode) { 
    247263    mode = newMode; 
     
    255271      OverlayObject[] objs = overlay.getObjects(); 
    256272      for (int i=0; i<objs.length; i++) { 
    257         if (objs[i] instanceof OverlayFreeform && objs[i] != freeform) otherFreefs.add(objs[i]); 
     273        if (objs[i] instanceof OverlayFreeform && objs[i] != freeform) { 
     274          otherFreefs.add(objs[i]); 
     275        } 
    258276      } 
    259277    } 
     
    272290 
    273291  /** Instructs this tool to respond to a mouse drag. */ 
    274   public void mouseDrag(int px, int py, float dx, float dy, int[] pos, int mods) { 
     292  public void mouseDrag(int px, int py, 
     293    float dx, float dy, int[] pos, int mods) 
     294  { 
    275295    boolean shift = (mods & InputEvent.SHIFT_MASK) != 0; 
    276296    boolean ctl = (mods & InputEvent.CTRL_MASK) != 0; 
     
    375395          // delete last node node 
    376396          freeform.deleteNode(index); 
    377           freeform.updateBoundingBox(); // WARNING this is O(n) expensive.  Maybe remove it and just update at 
    378                                         // mouseUp? 
    379         } 
    380         else { 
    381           setMode(DRAW); 
    382         } 
     397          // WARNING: this is O(n) expensive. 
     398          // Maybe remove it and just update at mouseUp? 
     399          freeform.updateBoundingBox(); 
     400        } 
     401        else setMode(DRAW); 
    383402        if (freeform.getNumNodes() == 0) setMode(CHILL); 
    384403      } 
     
    438457          } 
    439458        } 
    440         // tendril.tip always points to a lone node (except for before first drag, where it doesn't point to a 
    441         // node at all 
    442  
    443       } 
    444       else if (!shift && !equalsCase) { // reconnect with curve and delete nodes; 
     459        // tendril.tip always points to a lone node (except for before first 
     460        // drag, where it doesn't point to a node at all) 
     461      } 
     462      else if (!shift && !equalsCase) { 
     463        // reconnect with curve and delete nodes; 
    445464        if (tendril.tip < 0) { 
    446465          // tendril hasn't begun.  Do nothing. 
     
    465484          } 
    466485          else { 
    467             float[] a = freeform.getNodeCoords(seg + offset); // determine projection on seg. 
     486            // determine projection on seg. 
     487            float[] a = freeform.getNodeCoords(seg + offset); 
    468488            float[] b = freeform.getNodeCoords(seg + 1 + offset); 
    469489            float[] newXY = computePtOnSegment(a, b, (float) weight); 
     
    493513  //-- Additional methods 
    494514 
    495   /** Connects a pair of freeforms 
    496    *  @param f1 the freeform being drawn 
    497    *  @param f2 the freeform to be appended to f2 
    498    *  @param head whether the tail of f1 should be connected to the head (or if not, the tail) 
    499    *  of f2 
     515  /** 
     516   * Connects a pair of freeforms. 
     517   * @param f1 the freeform being drawn. 
     518   * @param f2 the freeform to be appended to f2. 
     519   * @param head whether the tail of f1 should be connected to the head 
     520   *   (or if not, the tail) of f2. 
    500521   */ 
    501522  private void connectFreeforms(OverlayFreeform f1, OverlayFreeform f2, 
     
    507528    for (int i=0; i<2; i++) { 
    508529      System.arraycopy(f1.getNodes()[i], 0, newNodes[i], 0, f1.getNumNodes()); 
    509       System.arraycopy(f2.getNodes()[i], 0, newNodes[i], f1.getNumNodes(), f2.getNumNodes()); 
     530      System.arraycopy(f2.getNodes()[i], 0, newNodes[i], 
     531        f1.getNumNodes(), f2.getNumNodes()); 
    510532    } 
    511533 
     
    524546    // returns only objects at the current dimensional position 
    525547    OverlayObject[] objects = overlay.getObjects(); 
    526     //Q: Hey, are all of these OverlayFreeforms?  A: No, it returns OverlayObjects of all types 
     548    // Q: Hey, are all of these OverlayFreeforms? 
     549    // A: No, it returns OverlayObjects of all types 
    527550 
    528551    OverlayFreeform closestFreeform = null; 
     
    535558          // rough check: is point within EDIT_THRESH of bounding box (fast) 
    536559          if (currentFreeform.getDistance(dx, dy) < EDIT_THRESH) { 
    537             // fine check: actually compute minimum distance to freeform (slower) 
     560            // fine check: actually compute minimum 
     561            // distance to freeform (slower) 
    538562            double[] distSegWt = 
    539563              MathUtil.getDistSegWt(currentFreeform.getNodes(), dx, dy); 
     
    550574  } 
    551575 
    552   /** Computes a point along the line segment a[]-b[] (2D) based on parameter weight */ 
     576  /** 
     577   * Computes a point along the line segment 
     578   * a[]-b[] (2D) based on parameter weight. 
     579   */ 
    553580  private float[] computePtOnSegment(float[] a, float[] b, float weight) { 
    554581    float dx = b[0] - a[0]; 
  • trunk/loci/visbio/overlays/OverlayFreeform.java

    r2024 r2096  
    110110  } 
    111111 
    112   /** Computes the shortest distance from this object's bounding box to the given point. */ 
     112  /** 
     113   * Computes the shortest distance from this 
     114   * object's bounding box to the given point. 
     115   */ 
    113116  public double getDistanceToBoundingBox(double x, double y) { 
    114117    double xdist = 0; 
  • trunk/loci/visbio/overlays/OverlayIO.java

    r1989 r2096  
    117117          int count = st.countTokens(); 
    118118          // parse table header from first valid line 
    119           int numDims = count - 10; // 12: number of non-dim. fields in overlay description 
     119          // 12: number of non-dim. fields in overlay description 
     120          int numDims = count - 10; 
    120121 
    121122          if (numDims < 0) { 
     
    141142 
    142143          if (!ObjectUtil.arraysEqual(dims, theDims)) { 
    143             displayErrorMsg(owner, lineNum, "dimensional axis types do not match"); 
     144            displayErrorMsg(owner, lineNum, 
     145              "dimensional axis types do not match"); 
    144146            return null; 
    145147          } 
    146148          if (!ObjectUtil.arraysEqual(lengths, theLengths)) { 
    147             displayErrorMsg(owner, lineNum, "dimensional axis lengths do not match"); 
     149            displayErrorMsg(owner, lineNum, 
     150              "dimensional axis lengths do not match"); 
    148151            return null; 
    149152          } 
  • trunk/loci/visbio/overlays/OverlayObject.java

    r2024 r2096  
    121121  /** True iff this overlay can be resized using X1, X2, Y1, Y2 entry boxes */ 
    122122  public boolean areBoundsEditable() { return !hasNodes; } 
    123   // currently, only noded objects can't be resized this way.  (Actually could perform some rad scaling on all nodes) 
     123  // currently, only noded objects can't be resized this way. 
     124  // (Actually could perform some rad scaling on all nodes) 
    124125 
    125126  /** True iff this overlay returns text to render. */ 
     
    258259  // TEMP // TEMP // TEMP 
    259260  public float[] getGridParameters() { 
    260     float[] retvals = {xGrid1, yGrid1, xGrid2, yGrid2, xGrid3, yGrid3, xGrid4, yGrid4}; 
     261    float[] retvals = { 
     262      xGrid1, yGrid1, xGrid2, yGrid2, xGrid3, yGrid3, xGrid4, yGrid4 
     263    }; 
    261264    return retvals; 
    262265  } 
     
    433436      nodes[0][nodeIndex] = newX; 
    434437      nodes[1][nodeIndex] = newY; 
    435     } else { 
    436       //System.out.println("Out of bounds error. Can't reset node coordinates"); // TEMP 
     438    } 
     439    else { 
     440      //TEMP: 
     441      //System.out.println("Out of bounds error. Can't reset node coordinates"); 
    437442    } 
    438443  } 
     
    448453  /** Sets next node coordinates. */ 
    449454  public void setNextNode(float x, float y) { 
    450    // System.out.println("OverlayObject.setNextNode(...) called.  numNodes = " + numNodes + ", maxNodes = " + maxNodes); 
     455    //System.out.println("OverlayObject.setNextNode(...) called. " + 
     456    //  "numNodes = " + numNodes + ", maxNodes = " + maxNodes); 
    451457    //printNodes(getNodes()); 
    452458    if (numNodes >= maxNodes) { 
     
    459465  } 
    460466 
    461   /** Inserts a node at coordinates provided before the node at the index provided */ 
    462   public void insertNode (int index, float x, float y) { 
     467  /** 
     468   * Inserts a node at coordinates provided 
     469   * before the node at the index provided. 
     470   */ 
     471  public void insertNode(int index, float x, float y) { 
    463472    if (index >= 0 && index < numNodes) { 
    464473      // if array is full, make some more room. 
     
    469478      for (int j = 0; j < 2; j++) { 
    470479        for (int i = numNodes; i > index; i--) { 
    471          nodes[j][i] = nodes[j][i-1]; // right shift every node right of index by 1 
     480          // right shift every node right of index by 1 
     481          nodes[j][i] = nodes[j][i-1]; 
    472482        } 
    473483      } 
     
    475485      nodes[1][index] = y; 
    476486      numNodes++; 
    477     } else { 
    478       //System.out.println ("index not in range (0, numNodes).  No node inserted"); 
     487    } 
     488    else { 
     489      //System.out.println("index not in range (0, numNodes). " + 
     490      //  "No node inserted"); 
    479491    } 
    480492  } 
     
    482494  /** Deletes a range of nodes from the node array */ 
    483495  public void deleteBetween (int i1, int i2) { 
    484     //assumes i1 < i2, both in bounds (less than numNodes) 
    485     //checks whether i1 + 1 < i2, i.e., is there a nonzero number of nodes to delete 
     496    // assumes i1 < i2, both in bounds (less than numNodes) 
     497    // checks whether i1 + 1 < i2, i.e., is there a non-zero 
     498    // number of nodes to delete 
    486499    if (0 <= i1 && i2 < numNodes && i1 + 1 < i2 ) { 
    487500      int victims = i2 - i1 - 1; 
     
    503516  public void deleteNode(int index) { 
    504517    if (index >=0 && index < numNodes) { 
    505       //built-in truncation 
    506       //System.out.println("OverlayObject.deleteNode(" + index +") called.  numNodes = " + numNodes + ", maxNodes = " + maxNodes); 
     518      // built-in truncation 
     519      //System.out.println("OverlayObject.deleteNode(" + index +") called. " + 
     520      //  "numNodes = " + numNodes + ", maxNodes = " + maxNodes); 
    507521      float [][] newNodes =  new float[2][numNodes-1]; 
    508522      System.arraycopy(nodes[0], 0, newNodes[0], 0, index); 
     
    560574    } 
    561575    maxNodes = newLength; 
    562     //System.out.println("resize completed. maxNodes = " + maxNodes + " numNodes =  " + numNodes); 
     576    //System.out.println("resize completed. maxNodes = " + 
     577    //  maxNodes + " numNodes =  " + numNodes); 
    563578    return a2; 
    564579  } 
  • trunk/loci/visbio/overlays/OverlayTransform.java

    r2095 r2096  
    764764 
    765765  /** Helper method for Display Changed -- releases left mouse button */ 
    766   protected void releaseLeft(DisplayEvent e, DisplayImpl display, OverlayTool tool) { 
     766  protected void releaseLeft(DisplayEvent e, 
     767    DisplayImpl display, OverlayTool tool) 
     768  { 
    767769    mouseDownLeft = false; 
    768770    updatePosition(display); 
  • trunk/loci/visbio/overlays/PointerTool.java

    r2095 r2096  
    4747  protected OverlayObject[] objs; 
    4848 
    49   /** Array of the bounds of the OverlayObjects at the current dimensional position */ 
     49  /** 
     50   * Array of the bounds of the OverlayObjects 
     51   * at the current dimensional position. 
     52   */ 
    5053  protected float[][] bounds; 
    5154 
  • trunk/loci/visbio/overlays/TransientSelectBox.java

    r2095 r2096  
    6060   *  Initially, the box has zero area and is not visible 
    6161   */ 
    62   public TransientSelectBox(OverlayTransform overlay, float downX, float downY) { 
     62  public TransientSelectBox(OverlayTransform overlay, 
     63    float downX, float downY) 
     64  { 
    6365    this.overlay = overlay; 
    6466    x1 = downX; 
Note: See TracChangeset for help on using the changeset viewer.