Search in sources :

Example 1 with UnknownFormat

use of org.geotools.coverage.grid.io.UnknownFormat in project sldeditor by robward-scisys.

the class DetermineRasterFormat method choose.

/**
 * Get user to choose raster format.
 *
 * @param rasterFile the raster file
 * @param selectionPanel the selection panel
 * @return the abstract grid format
 */
public static AbstractGridFormat choose(File rasterFile, ChooseRasterFormatInterface selectionPanel) {
    if (rasterFile != null) {
        final Set<AbstractGridFormat> formats = GridFormatFinder.findFormats(rasterFile, GeoTools.getDefaultHints());
        if (!classUndertest && (formats.size() > 1)) {
            if (selectionPanel != null) {
                AbstractGridFormat selectedFormat = selectionPanel.showPanel(formats);
                if (selectedFormat != null) {
                    return selectedFormat;
                }
            }
        }
        // otherwise just pick the first
        final Iterator<AbstractGridFormat> it = formats.iterator();
        if (it.hasNext()) {
            return it.next();
        }
    }
    return new UnknownFormat();
}
Also used : UnknownFormat(org.geotools.coverage.grid.io.UnknownFormat) AbstractGridFormat(org.geotools.coverage.grid.io.AbstractGridFormat)

Aggregations

AbstractGridFormat (org.geotools.coverage.grid.io.AbstractGridFormat)1 UnknownFormat (org.geotools.coverage.grid.io.UnknownFormat)1