if (getYCoordinateFirst() == null) {
setYCoordinateFirst(false);
}
GridSet gridSet;
String name = getName();
SRS srs = getSrs();
BoundingBox extent = getExtent();
Boolean alignTopLeft = getAlignTopLeft();
double[] resolutions = getResolutions();
double[] scaleDenominators = getScaleDenominators();
Double metersPerUnit = getMetersPerUnit();
Double pixelSize = getPixelSize();
String[] scaleNames = getScaleNames();
Integer tileWidth = getTileWidth();
Integer tileHeight = getTileHeight();
Boolean yCoordinateFirst = getYCoordinateFirst();
if (getResolutions() != null || getScaleDenominators() != null) {
gridSet = GridSetFactory.createGridSet(name, srs, extent, alignTopLeft, resolutions,
scaleDenominators, metersPerUnit, pixelSize, scaleNames, tileWidth, tileHeight,
yCoordinateFirst);
} else {
if (getLevels() == null) {
setLevels(18);
}
Integer levels = getLevels();
gridSet = GridSetFactory.createGridSet(name, srs, extent, alignTopLeft, levels,
metersPerUnit, pixelSize, tileWidth, tileHeight, yCoordinateFirst);
}
gridSet.setDescription(getDescription());
return gridSet;
}