示例#1
0
  private void autoscale() {

    int stateHash = FrameManager.getStateHash();

    //  if(lastFrameStateHash == stateHash) return;

    lastStateHash = stateHash;

    final Collection<Track> trackList = IGV.getInstance().getAllTracks();

    Map<String, List<Track>> autoscaleGroups = new HashMap<String, List<Track>>();

    for (Track track : trackList) {

      if (!track.isVisible()) continue;

      String asGroup = track.getAttributeValue(AttributeManager.GROUP_AUTOSCALE);
      if (asGroup != null) {
        if (!autoscaleGroups.containsKey(asGroup)) {
          autoscaleGroups.put(asGroup, new ArrayList<Track>());
        }
        autoscaleGroups.get(asGroup).add(track);
      } else if (track.getAutoScale()) {
        autoscaleGroup(Arrays.asList(track));
      }
    }

    if (autoscaleGroups.size() > 0) {
      for (List<Track> tracks : autoscaleGroups.values()) {
        autoscaleGroup(tracks);
      }
    }
  }
示例#2
0
 public void createDataPanels() {
   removeAll();
   for (ReferenceFrame f : FrameManager.getFrames()) {
     if (f.isVisible()) {
       DataPanel dp = new DataPanel(f, this);
       add(dp);
     }
   }
   invalidate();
 }
示例#3
0
  private void autoscaleGroup(List<Track> trackList) {

    List<ReferenceFrame> frames =
        FrameManager.isGeneListMode()
            ? FrameManager.getFrames()
            : Arrays.asList(FrameManager.getDefaultFrame());

    List<Range> inViewRanges = new ArrayList<Range>();

    synchronized (trackList) {
      for (Track track : trackList) {
        if (track instanceof ScalableTrack) {
          for (ReferenceFrame frame : frames) {
            Range range = ((ScalableTrack) track).getInViewRange(frame);
            if (range != null) {
              inViewRanges.add(range);
            }
          }
        }
      }

      if (inViewRanges.size() > 0) {

        Range inter = computeScale(inViewRanges);

        for (Track track : trackList) {

          DataRange dr = track.getDataRange();
          float min = Math.min(0, inter.min);
          float base = Math.max(min, dr.getBaseline());
          float max = inter.max;
          // Pathological case where min ~= max  (no data in view)
          if (max - min <= (2 * Float.MIN_VALUE)) {
            max = min + 1;
          }

          DataRange newDR = new DataRange(min, base, max, dr.isDrawBaseline());
          newDR.setType(dr.getType());
          track.setDataRange(newDR);
        }
      }
    }
  }