public void Add(PosTab tab) { foreach (Pos pos in tab.AllObjs()) { Add(pos); } }
public PosTab Copy() { PosTab copy = new PosTab(rect, resolution); for (int c = 0; c < cells.array.Length; c++) { copy.cells.array[c].count = cells.array[c].count; copy.cells.array[c].rect = cells.array[c].rect; if (cells.array[c].poses == null) { continue; } copy.cells.array[c].poses = new Pos[cells.array[c].poses.Length]; Array.Copy(cells.array[c].poses, copy.cells.array[c].poses, cells.array[c].poses.Length); } return(copy); }
public static PosTab Combine(params PosTab[] posTabs) //TODO: combine ids are not unique { if (posTabs.Length == 0) { return(null); } PosTab any = ArrayTools.Any(posTabs); if (any == null) { return(null); } PosTab result = new PosTab(any.rect, any.resolution); for (int i = 0; i < posTabs.Length; i++) { PosTab posTab = posTabs[i]; if (posTab == null) { continue; } for (int c = 0; c < posTab.cells.array.Length; c++) { Cell cell = posTab.cells.array[c]; for (int p = 0; p < cell.count; p++) { result.Add(cell.poses[p]); } } } return(result); }