Search in sources :

Example 1 with FeatureCatalogueDescription

use of org.opengis.metadata.content.FeatureCatalogueDescription in project sis by apache.

the class MergerTest method testDeepMerge.

/**
 * Tests a merge operation that merge also the collection elements. Such deep merge is a
 * little bit aggressive; it may be desired in some occasions, but may also be dangerous.
 */
@Test
public void testDeepMerge() {
    final DefaultMetadata source = createSample1();
    final DefaultMetadata target = createSample2();
    final Merger merger = new Merger(null);
    merger.copy(source, target);
    assertSetEquals(Arrays.asList(Locale.JAPANESE, Locale.FRENCH), target.getLanguages());
    assertSetEquals(Collections.singleton(StandardCharsets.UTF_16), target.getCharacterSets());
    final Iterator<ContentInformation> it = target.getContentInfo().iterator();
    final ImageDescription image = (ImageDescription) it.next();
    final FeatureCatalogueDescription features = (FeatureCatalogueDescription) it.next();
    final DefaultCoverageDescription coverage = (DefaultCoverageDescription) it.next();
    assertFalse(it.hasNext());
    assertEquals("imagingCondition", ImagingCondition.CLOUD, image.getImagingCondition());
    assertEquals("cloudCoverPercentage", Double.valueOf(0.8), image.getCloudCoverPercentage());
    assertEquals("processingLevelCode", "Level 2", image.getProcessingLevelCode().getCode());
    assertEquals("processingLevelCode", "Level 1", coverage.getProcessingLevelCode().getCode());
    assertEquals("includedWithDataset", Boolean.TRUE, features.isIncludedWithDataset());
    final Iterator<? extends Citation> ci = features.getFeatureCatalogueCitations().iterator();
    assertEquals("GPX file", ci.next().getTitle().toString());
    assertEquals("Shapefile", ci.next().getTitle().toString());
    assertFalse(ci.hasNext());
}
Also used : FeatureCatalogueDescription(org.opengis.metadata.content.FeatureCatalogueDescription) DefaultFeatureCatalogueDescription(org.apache.sis.metadata.iso.content.DefaultFeatureCatalogueDescription) DefaultMetadata(org.apache.sis.metadata.iso.DefaultMetadata) ContentInformation(org.opengis.metadata.content.ContentInformation) DefaultCoverageDescription(org.apache.sis.metadata.iso.content.DefaultCoverageDescription) ImageDescription(org.opengis.metadata.content.ImageDescription) DefaultImageDescription(org.apache.sis.metadata.iso.content.DefaultImageDescription) Test(org.junit.Test)

Example 2 with FeatureCatalogueDescription

use of org.opengis.metadata.content.FeatureCatalogueDescription in project sis by apache.

the class ReaderTest method verifyAlmostEmptyMetadata.

/**
 * Verifies that the given metadata contains only bounds information
 * and the hard-coded list of feature types.
 */
private static void verifyAlmostEmptyMetadata(final Metadata md) {
    assertNull("name", md.name);
    assertNull("description", md.description);
    assertNull("time", md.time);
    assertNull("keywords", md.keywords);
    assertBoundsEquals(-20, 30, 10, 40, md.bounds);
    assertNull("author", md.author);
    assertNull("copyright", md.copyright);
    assertNull("links", md.links);
    /*
         * Verifies the list of feature types declared in the given metadata. Those features
         * are not listed in GPX files; they are rather hard-coded in Types.metadata constant.
         */
    final FeatureCatalogueDescription content = (FeatureCatalogueDescription) getSingleton(md.getContentInfo());
    assertTrue("isIncludedWithDataset", content.isIncludedWithDataset());
    final Iterator<? extends GenericName> it = content.getFeatureTypes().iterator();
    assertStringEquals("Route", it.next().tip());
    assertStringEquals("Track", it.next().tip());
    assertStringEquals("WayPoint", it.next().tip());
    assertFalse("hasNext", it.hasNext());
}
Also used : FeatureCatalogueDescription(org.opengis.metadata.content.FeatureCatalogueDescription)

Aggregations

FeatureCatalogueDescription (org.opengis.metadata.content.FeatureCatalogueDescription)2 DefaultMetadata (org.apache.sis.metadata.iso.DefaultMetadata)1 DefaultCoverageDescription (org.apache.sis.metadata.iso.content.DefaultCoverageDescription)1 DefaultFeatureCatalogueDescription (org.apache.sis.metadata.iso.content.DefaultFeatureCatalogueDescription)1 DefaultImageDescription (org.apache.sis.metadata.iso.content.DefaultImageDescription)1 Test (org.junit.Test)1 ContentInformation (org.opengis.metadata.content.ContentInformation)1 ImageDescription (org.opengis.metadata.content.ImageDescription)1