/**
* Calculate which rows and which columns need to be output.
*/
protected void calculateOutput() {
AbstractGrid grid = (AbstractGrid) format;
// We need to reset the required rows and columns array to 'not required'
// in order for this method to work for spatial iterators. This method
// sets the values of the column/row to be true only if that row/column
// is not empty. Given that there isn't an array of columns for each row,
// this is preferred method. Ideally we should store an array of columns
// for each row and if one column is required then that row is required.
// The additional memory and processing required to achieve this probably
// outweighs simply resetting the arrays below (most rows and columns
// should contain only a few items).
for (int i = 0; i < requiredColumns.length; i++) {
requiredColumns[i] = false;
}
for (int i = 0; i < requiredRows.length; i++) {
requiredRows[i] = false;
}
for (int r = 0; r < rows; r++) {
for (int c = 0; c < columns; c++) {
int gridIndex = r * columns + c;
Format child = grid.getChildAt(gridIndex);
// Ignore children which do not exist.
if (child == null) {
continue;
}