Example usage for java.awt Rectangle add

List of usage examples for java.awt Rectangle add

Introduction

In this page you can find the example usage for java.awt Rectangle add.

Prototype

public void add(int newx, int newy) 

Source Link

Document

Adds a point, specified by the integer arguments newx,newy to the bounds of this Rectangle .

Usage

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    Rectangle r = new Rectangle(10, 10, 50, 40);

    r.add(40, 40);

    g2.fill(r);/*from   w w w. ja va 2s .  co  m*/

}

From source file:org.csml.tommo.sugar.modules.TileTree.java

@Override
public void processSequence(Sequence sequence) {

    char[] chars = sequence.getQualityString().toCharArray();
    for (int c = 0; c < chars.length; c++) {
        if (chars[c] < lowestChar) {
            lowestChar = chars[c];/*from  w ww  . j  av  a  2 s  .co  m*/
        }
    }

    SequenceCoordinates seqCoord = SequenceCoordinates.createSequenceCoordinates(sequence);

    // storeSequenceCoordinates(SequenceCoordinates seqCoord)
    String flowCell = seqCoord.getFlowCell();

    flowCellSet.add(flowCell);

    SortedSet<Integer> laneIDs = laneIDsMap.get(flowCell);
    if (laneIDs == null) {
        laneIDs = new TreeSet<Integer>();
        laneIDsMap.put(flowCell, laneIDs);
    }
    laneIDs.add(seqCoord.getLane());

    LaneCoordinates laneCoordinates = new LaneCoordinates(seqCoord.getFlowCell(), seqCoord.getLane());
    SortedSet<Integer> tileIDs = tileIDsMap.get(laneCoordinates);
    if (tileIDs == null) {
        tileIDs = new TreeSet<Integer>();
        tileIDsMap.put(laneCoordinates, tileIDs);
    }
    tileIDs.add(seqCoord.getTile());

    TileCoordinates tileCoordinates = new TileCoordinates(seqCoord.getFlowCell(), seqCoord.getLane(),
            seqCoord.getTile());
    //      SortedSet<Integer> xCoordinates = xCoordinatesMap.get(tileCoordinates);
    //      if (xCoordinates == null)
    //      {
    //         xCoordinates = new TreeSet<Integer>();
    //         xCoordinatesMap.put(tileCoordinates, xCoordinates);
    //      }
    //      xCoordinates.add(seqCoord.getX());
    //      
    //      SortedSet<Integer> yCoordinates = yCoordinatesMap.get(tileCoordinates);
    //      if (yCoordinates == null)
    //      {
    //         yCoordinates = new TreeSet<Integer>();
    //         yCoordinatesMap.put(tileCoordinates, yCoordinates);
    //      }      
    //      yCoordinates.add(seqCoord.getY());

    Rectangle range = xyRangeMap.get(tileCoordinates);
    if (range == null) {
        range = new Rectangle(0, 0, -1, -1);
        xyRangeMap.put(tileCoordinates, range);
    }
    range.add(seqCoord.getX(), seqCoord.getY());

}