public AbstractGridFormat createFormat() { return new UnknownFormat(); }
return it.next(); return new UnknownFormat();
public AbstractGridFormat createFormat() { return new UnknownFormat(); }
/** * Returns a {@link Format} that is able to read a certain object. If no * {@link Format} is able to read such an {@link Object} we return an * {@link UnknownFormat} object. * * <p> * It is worth to point out that this method will try to convert each format * implementation to {@link AbstractGridFormat} because the original * {@link Format} interface did not allow for an accept method hence we had * to subclass the interface to add such method and we did so by the * {@link AbstractGridFormat} abstract class. * * @param o * the object to check for acceptance. * @return an {@link AbstractGridFormat} that has stated to accept this * {@link Object} o or <code>null</code> in no plugins was able to * accept it. */ public static synchronized Format findFormat(Object o) { final Set formats = findFormats(o); final Iterator it = formats.iterator(); if (it.hasNext()) return (Format) it.next(); return new UnknownFormat(); } }
/** * Returns a {@link Format} that is able to read a certain object. If no * {@link Format} is able to read such an {@link Object} we return an * {@link UnknownFormat} object. * * <p> * It is worth to point out that this method will try to convert each format * implementation to {@link AbstractGridFormat} because the original * {@link Format} interface did not allow for an accept method hence we had * to subclass the interface to add such method and we did so by the * {@link AbstractGridFormat} abstract class. * * @param o * the object to check for acceptance. * @param hints * the {@link Hints} to control the format search. * @return an {@link AbstractGridFormat} that has stated to accept this * {@link Object} o or <code>null</code> in no plugins was able to * accept it. */ public static synchronized AbstractGridFormat findFormat(Object o, Hints hints) { final Set<AbstractGridFormat> formats = findFormats(o,hints); final Iterator<AbstractGridFormat> it = formats.iterator(); if (it.hasNext()){ return (AbstractGridFormat) it.next(); } return new UnknownFormat(); } }
/** * 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(); }
format=cachedFormat; } else { format=new UnknownFormat();