Search in sources :

Example 1 with FeatureDatasetPoint

use of ucar.nc2.ft.FeatureDatasetPoint in project sis by apache.

the class DecoderWrapper method getDiscreteSampling.

/**
 * If this decoder can handle the file content as features, returns handlers for them.
 *
 * @return {@inheritDoc}
 * @throws IOException if an I/O operation was necessary but failed.
 * @throws DataStoreException if the library of geometric objects is not available.
 */
@Override
@SuppressWarnings("null")
public DiscreteSampling[] getDiscreteSampling() throws IOException, DataStoreException {
    if (features == null && file instanceof NetcdfDataset) {
        features = FeatureDatasetFactoryManager.wrap(null, (NetcdfDataset) file, this, new Formatter(new LogAdapter(listeners), listeners.getLocale()));
    }
    List<FeatureCollection> fc = null;
    if (features instanceof FeatureDatasetPoint) {
        fc = ((FeatureDatasetPoint) features).getPointFeatureCollectionList();
    }
    final FeaturesWrapper[] wrappers = new FeaturesWrapper[(fc != null) ? fc.size() : 0];
    try {
        for (int i = 0; i < wrappers.length; i++) {
            wrappers[i] = new FeaturesWrapper(fc.get(i), geomlib, listeners);
        }
    } catch (IllegalArgumentException e) {
        throw new DataStoreException(e.getLocalizedMessage(), e);
    }
    return wrappers;
}
Also used : FeatureDatasetPoint(ucar.nc2.ft.FeatureDatasetPoint) DataStoreException(org.apache.sis.storage.DataStoreException) FeatureCollection(ucar.nc2.ft.FeatureCollection) Formatter(java.util.Formatter) CalendarDateFormatter(ucar.nc2.time.CalendarDateFormatter) NetcdfDataset(ucar.nc2.dataset.NetcdfDataset) FeatureDatasetPoint(ucar.nc2.ft.FeatureDatasetPoint)

Aggregations

Formatter (java.util.Formatter)1 DataStoreException (org.apache.sis.storage.DataStoreException)1 NetcdfDataset (ucar.nc2.dataset.NetcdfDataset)1 FeatureCollection (ucar.nc2.ft.FeatureCollection)1 FeatureDatasetPoint (ucar.nc2.ft.FeatureDatasetPoint)1 CalendarDateFormatter (ucar.nc2.time.CalendarDateFormatter)1