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;
}
}
}
Aggregations