Exemplo n.º 1
0
  public int[] getCurrentRegionWindowGenomicPositions() {

    // address int overflow or exceeding bound issues
    int xEndEdge =
        xContext.getGenomicPositionOrigin()
            + (int)
                ((double) getZoom().getBinSize()
                    * superAdapter.getHeatmapPanel().getWidth()
                    / getScaleFactor());
    if (xEndEdge < 0 || xEndEdge > xContext.getChromosome().getLength()) {
      xEndEdge = xContext.getChromosome().getLength();
    }

    int yEndEdge =
        yContext.getGenomicPositionOrigin()
            + (int)
                ((double) getZoom().getBinSize()
                    * superAdapter.getHeatmapPanel().getHeight()
                    / getScaleFactor());
    if (yEndEdge < 0 || yEndEdge > yContext.getChromosome().getLength()) {
      yEndEdge = yContext.getChromosome().getLength();
    }

    return new int[] {
      xContext.getGenomicPositionOrigin(), xEndEdge, yContext.getGenomicPositionOrigin(), yEndEdge
    };
  }