Search in sources :

Example 1 with AbstractSpatialRepresentation

use of org.apache.sis.metadata.iso.spatial.AbstractSpatialRepresentation in project geotoolkit by Geomatys.

the class DimapAccessor method getSpatialRepresentationInfo.

private static AbstractSpatialRepresentation getSpatialRepresentationInfo(final DefaultMetadata metadata) {
    final Collection<SpatialRepresentation> spa = metadata.getSpatialRepresentationInfo();
    if (spa.isEmpty()) {
        final DefaultGridSpatialRepresentation sp = new DefaultGridSpatialRepresentation();
        spa.add(sp);
        return sp;
    } else {
        final List<SpatialRepresentation> copies = new ArrayList<SpatialRepresentation>(spa);
        final SpatialRepresentation id = copies.get(0);
        if (id instanceof DefaultGridSpatialRepresentation) {
            return (DefaultGridSpatialRepresentation) id;
        } else {
            final AbstractSpatialRepresentation copy = DefaultGridSpatialRepresentation.castOrCopy(id);
            copies.set(0, copy);
            // copy and replace collection
            metadata.setSpatialRepresentationInfo(copies);
            return copy;
        }
    }
}
Also used : AbstractSpatialRepresentation(org.apache.sis.metadata.iso.spatial.AbstractSpatialRepresentation) DefaultGridSpatialRepresentation(org.apache.sis.metadata.iso.spatial.DefaultGridSpatialRepresentation) AbstractSpatialRepresentation(org.apache.sis.metadata.iso.spatial.AbstractSpatialRepresentation) SpatialRepresentation(org.opengis.metadata.spatial.SpatialRepresentation) DefaultGridSpatialRepresentation(org.apache.sis.metadata.iso.spatial.DefaultGridSpatialRepresentation) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 AbstractSpatialRepresentation (org.apache.sis.metadata.iso.spatial.AbstractSpatialRepresentation)1 DefaultGridSpatialRepresentation (org.apache.sis.metadata.iso.spatial.DefaultGridSpatialRepresentation)1 SpatialRepresentation (org.opengis.metadata.spatial.SpatialRepresentation)1