protected void groupFrames(Vector<Frame> frames,Vector<Group> groups,boolean isDchum) throws MakeTocException {
  Frame frame;
  Group group;
  int groupCount;
  int nFrames=frames.size();
  Debug.message("maketoc","MakeToc: *** grouping frames ***");
  for (int i=0; i < nFrames; i++) {
    Debug.message("maketocdetail","MakeToc: group addition, starting outer loop");
    frame=(Frame)frames.elementAt(i);
    if (!frame.marked) {
      groupCount=groups.size();
      group=new Group();
      group.left=maxSide / 2;
      group.right=group.left + 1;
      group.top=maxSide / 2;
      group.bottom=group.top + 1;
      group.horiz_pos[group.top]=frame.top;
      group.horiz_pos[group.bottom]=frame.bottom;
      group.vert_pos[group.left]=frame.left;
      group.vert_pos[group.right]=frame.right;
      group.h_interval=frame.h_interval;
      group.v_interval=frame.v_interval;
      group.h_resolution=frame.h_resolution;
      group.v_resolution=frame.v_resolution;
      group.scale=frame.scale;
      group.zone=frame.zone;
      group.cib=frame.cib;
      group.cdted=frame.cdted;
      frame.x=group.left;
      frame.y=group.top;
      frame.group=groupCount;
      frame.marked=true;
      Debug.message("maketocdetail","Maketoc.groupFrames: created group " + groupCount + " for frame "+ i+ ", - "+ frame.filename+ " checking other frames for neighbors");
      if (!isDchum) {
        for (int j=0; j < nFrames; j++) {
          if (i == j) {
            Debug.message("maketocdetail","Maketoc.groupFrames: inner loop, i = j = " + i + ", frame that created group added to group, expecting false return");
            continue;
          }
          Frame f=(Frame)frames.elementAt(j);
          if (addFrameToGroup(group,f,groupCount)) {
            Debug.message("maketocdetail","Maketoc.groupFrames: added frame " + j + " to group "+ groupCount);
            continue;
          }
        }
      }
      Debug.message("maketocdetail","Maketoc.groupFrames: adding another group - " + groupCount + " *******************\n\n");
      groups.add(group);
    }
    fireProgressUpdate(ProgressEvent.UPDATE,"Organizing frames",i,nFrames);
  }
  if (Debug.debugging("maketoc")) {
    Debug.output("MakeToc: Number of boundary rectangles (groups): " + groups.size());
  }
}

protected void groupFrames ( Vector < Frame > frames , Vector < Group > groups , boolean isDchum ) throws MakeTocException { Frame frame ; Group group ; int groupCount ; int nFrames = frames . size ( ) ; Debug . message ( "maketoc" , "MakeToc: *** grouping frames ***" ) ; for ( int i = 0 ; i < nFrames ; i ++ ) { Debug . message ( "maketocdetail" , "MakeToc: group addition, starting outer loop" ) ; frame = ( Frame ) frames . elementAt ( i ) ; if ( ! frame . marked ) { groupCount = groups . size ( ) ; group = new Group ( ) ; group . left = maxSide / 2 ; group . right = group . left + 1 ; group . top = maxSide / 2 ; group . bottom = group . top + 1 ; group . horiz_pos [ group . top ] = frame . top ; group . horiz_pos [ group . bottom ] = frame . bottom ; group . vert_pos [ group . left ] = frame . left ; group . vert_pos [ group . right ] = frame . right ; group . h_interval = frame . h_interval ; group . v_interval = frame . v_interval ; group . h_resolution = frame . h_resolution ; group . v_resolution = frame . v_resolution ; group . scale = frame . scale ; group . zone = frame . zone ; group . cib = frame . cib ; group . cdted = frame . cdted ; frame . x = group . left ; frame . y = group . top ; frame . group = groupCount ; frame . marked = true ; Debug . message ( "maketocdetail" , "Maketoc.groupFrames: created group " + groupCount + " for frame " + i + ", - " + frame . filename + " checking other frames for neighbors" ) ; if ( ! isDchum ) { for ( int j = 0 ; j < nFrames ; j ++ ) { if ( i == j ) { Debug . message ( "maketocdetail" , "Maketoc.groupFrames: inner loop, i = j = " + i + ", frame that created group added to group, expecting false return" ) ; continue ; } Frame f = ( Frame ) frames . elementAt ( j ) ; if ( addFrameToGroup ( group , f , groupCount ) ) { Debug . message ( "maketocdetail" , "Maketoc.groupFrames: added frame " + j + " to group " + groupCount ) ; continue ; } } } Debug . message ( "maketocdetail" , "Maketoc.groupFrames: adding another group - " + groupCount + " *******************\n\n" ) ; groups . add ( group ) ; } fireProgressUpdate ( ProgressEvent . UPDATE , "Organizing frames" , i , nFrames ) ; } if ( Debug . debugging ( "maketoc" ) ) { Debug . output ( "MakeToc: Number of boundary rectangles (groups): " + groups . size ( ) ) ; } }
take the vector of frames , and group them into boundary rectangles , represented by groups . if dchum is present , all frames get placed in their own group .
