Search in sources :

Example 1 with DefaultInstant

use of org.geotoolkit.temporal.object.DefaultInstant in project geotoolkit by Geomatys.

the class DefaultTemporalFactory method createInstant.

/**
 * {@inheritDoc }
 */
@Override
public Instant createInstant(final Date instant) {
    final Map<String, Object> prop = new HashMap<>();
    prop.put(IdentifiedObject.NAME_KEY, "instant" + instantCount++);
    if (instant != null) {
        return new DefaultInstant(prop, instant);
    } else {
        final TemporalPosition position = new DefaultTemporalPosition(IndeterminateValue.UNKNOWN);
        return new DefaultInstant(prop, position);
    }
}
Also used : HashMap(java.util.HashMap) DefaultTemporalPosition(org.geotoolkit.temporal.object.DefaultTemporalPosition) TemporalPosition(org.opengis.temporal.TemporalPosition) DefaultInstant(org.geotoolkit.temporal.object.DefaultInstant) IdentifiedObject(org.opengis.referencing.IdentifiedObject) InternationalString(org.opengis.util.InternationalString) DefaultTemporalPosition(org.geotoolkit.temporal.object.DefaultTemporalPosition)

Example 2 with DefaultInstant

use of org.geotoolkit.temporal.object.DefaultInstant in project geotoolkit by Geomatys.

the class DefaultOrdinalEra method getEndd.

/**
 * Returns a {@link TemporalNode} create from {@link #end} object, use for XML binding.
 *
 * @return a {@link TemporalNode} create from {@link #end} object, use for XML binding.
 */
@XmlElement(name = "end")
private DefaultTemporalNode getEndd() {
    final Identifier iden = getName();
    final Map<String, Object> instantProp = new HashMap<>();
    instantProp.put(NAME_KEY, new NamedIdentifier(null, iden.getCode() + "_end instant"));
    final Map<String, Object> nodeProp = new HashMap<>();
    nodeProp.put(NAME_KEY, new NamedIdentifier(null, iden.getCode() + "_end node"));
    final DefaultTemporalNode start = new DefaultTemporalNode(nodeProp, new DefaultInstant(instantProp, begin), null, null);
    return start;
}
Also used : NamedIdentifier(org.apache.sis.referencing.NamedIdentifier) Identifier(org.opengis.metadata.Identifier) HashMap(java.util.HashMap) NamedIdentifier(org.apache.sis.referencing.NamedIdentifier) DefaultInstant(org.geotoolkit.temporal.object.DefaultInstant) NilReferencingObject(org.apache.sis.internal.referencing.NilReferencingObject) AbstractIdentifiedObject(org.apache.sis.referencing.AbstractIdentifiedObject) DefaultTemporalNode(org.geotoolkit.temporal.object.DefaultTemporalNode) XmlElement(javax.xml.bind.annotation.XmlElement)

Example 3 with DefaultInstant

use of org.geotoolkit.temporal.object.DefaultInstant in project geotoolkit by Geomatys.

the class WmsXmlBindingTest method inpsireExtensionmarshallingTest.

/**
 * Test simple Record Marshalling.
 */
@Test
public void inpsireExtensionmarshallingTest() throws Exception {
    ExtendedCapabilitiesType ext = new ExtendedCapabilitiesType();
    NameFactory nameFactory = new DefaultNameFactory();
    ObjectFactory factory = new ObjectFactory();
    ext.setResourceType(ScopeCode.SERVICE);
    ext.setSpatialDataService(new ServiceType(nameFactory.createLocalName(null, "view")));
    ext.setResourcelocator(new DefaultOnlineResource(URI.create("http://javacestpasdlamenthealeau.com")));
    ext.setMetadataUrl(new DefaultOnlineResource(URI.create("http://javacestdurocknroll.com")));
    DefaultExtent extent = new DefaultExtent();
    DefaultTemporalExtent tempExt = new DefaultTemporalExtent();
    NamedIdentifier periodName = new NamedIdentifier(null, "period");
    final Map<String, Object> periodProp = new HashMap<>();
    periodProp.put(IdentifiedObject.NAME_KEY, periodName);
    NamedIdentifier name = new NamedIdentifier(null, "period instant");
    final Map<String, Object> properties = new HashMap<>();
    properties.put(IdentifiedObject.NAME_KEY, name);
    DefaultPeriod period = new DefaultPeriod(periodProp, new DefaultInstant(properties, new Date(120000000)), new DefaultInstant(properties, new Date(120000001)));
    // period.setBegining(new DefaultInstant(properties, new DefaultPosition(new Date(120000000))));
    // period.setEnding(new DefaultInstant(properties, new DefaultPosition(new Date(120000001))));
    // org.apache.sis.internal.jaxb.gml.GMLAdapter.IDs.setUUID(period, "extent");
    tempExt.setExtent(period);
    extent.setTemporalElements(Arrays.asList(tempExt));
    ext.setTemporalRefererence(extent);
    DefaultConformanceResult cresult = new DefaultConformanceResult(HardCodedCitations.EPSG, new DefaultInternationalString("see the referenced specification"), true);
    ext.setConformity(cresult);
    ResponsibleParty party = DefaultResponsibleParty.castOrCopy(HardCodedCitations.EPSG.getCitedResponsibleParties().iterator().next());
    ext.setMetadataPointOfContact(party);
    ext.setMetadataDate(new Date(82800000));
    DefaultKeywords key = new DefaultKeywords(new SimpleInternationalString("something"));
    ext.setInpireKeywords(key);
    List<LanguageType> langs = new ArrayList<>();
    langs.add(new LanguageType("FR"));
    langs.add(new LanguageType("EN", true));
    LanguagesType languages = new LanguagesType(langs);
    ext.setLanguages(languages);
    ext.setCurrentLanguage("FR");
    JAXBElement<ExtendedCapabilitiesType> jbExtendedCap = factory.createExtendedCapabilities(ext);
    Capability capability = new Capability(null, null, null, jbExtendedCap);
    StringWriter sw = new StringWriter();
    marshaller.marshal(capability, sw);
    String result = sw.toString();
    String expResult = "<wms:Capability xmlns:wms=\"http://www.opengis.net/wms\"" + " xmlns:gmd=\"http://www.isotc211.org/2005/gmd\"" + " xmlns:gco=\"http://www.isotc211.org/2005/gco\"" + " xmlns:srv=\"http://www.isotc211.org/2005/srv\"" + " xmlns:inspire_vs=\"http://inspira.europa.eu/networkservice/view/1.0\"" + " xmlns:gml=\"http://www.opengis.net/gml/3.2\">" + '\n' + "    <inspire_vs:ExtendedCapabilities>" + '\n' + "        <inspire_vs:Resourcelocator>" + '\n' + "            <gmd:linkage>" + '\n' + "                <gmd:URL>http://javacestpasdlamenthealeau.com</gmd:URL>" + '\n' + "            </gmd:linkage>" + '\n' + "        </inspire_vs:Resourcelocator>" + '\n' + "        <inspire_vs:MetadataUrl>" + '\n' + "            <gmd:linkage>" + '\n' + "                <gmd:URL>http://javacestdurocknroll.com</gmd:URL>" + '\n' + "            </gmd:linkage>" + '\n' + "        </inspire_vs:MetadataUrl>" + '\n' + "        <inspire_vs:ResourceType>" + '\n' + "            <gmd:MD_ScopeCode codeList=\"http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode\" codeListValue=\"service\">Service</gmd:MD_ScopeCode>" + '\n' + "        </inspire_vs:ResourceType>" + '\n' + "        <inspire_vs:TemporalRefererence>" + '\n' + "            <gmd:EX_Extent>" + '\n' + "                <gmd:temporalElement>" + '\n' + "                    <gmd:EX_TemporalExtent>" + '\n' + "                        <gmd:extent>" + '\n' + "                            <gml:TimePeriod>" + '\n' + "                                <gml:beginPosition>1970-01-02T10:20:00+01:00</gml:beginPosition>" + '\n' + "                                <gml:endPosition>1970-01-02T10:20:00.001+01:00</gml:endPosition>" + '\n' + "                            </gml:TimePeriod>" + '\n' + "                        </gmd:extent>" + '\n' + "                    </gmd:EX_TemporalExtent>" + '\n' + "                </gmd:temporalElement>" + '\n' + "            </gmd:EX_Extent>" + '\n' + "        </inspire_vs:TemporalRefererence>" + '\n' + "        <inspire_vs:Conformity>" + '\n' + "            <gmd:DQ_ConformanceResult>" + '\n' + "                <gmd:specification>" + '\n' + "                    <gmd:CI_Citation>" + '\n' + "                        <gmd:title>" + '\n' + "                            <gco:CharacterString>EPSG Geodetic Parameter Dataset</gco:CharacterString>" + '\n' + "                        </gmd:title>" + '\n' + "                        <gmd:identifier>" + '\n' + "                            <gmd:MD_Identifier>" + '\n' + "                                <gmd:code>" + '\n' + "                                    <gco:CharacterString>EPSG</gco:CharacterString>" + '\n' + "                                </gmd:code>" + '\n' + "                            </gmd:MD_Identifier>" + '\n' + "                        </gmd:identifier>" + '\n' + "                        <gmd:citedResponsibleParty>" + '\n' + "                            <gmd:CI_ResponsibleParty>" + '\n' + "                                <gmd:organisationName>" + '\n' + "                                    <gco:CharacterString>International Association of Oil &amp; Gas Producers</gco:CharacterString>" + '\n' + "                                </gmd:organisationName>" + '\n' + "                                <gmd:contactInfo>\n" + "                                    <gmd:CI_Contact>\n" + "                                        <gmd:onlineResource>\n" + "                                            <gmd:CI_OnlineResource>\n" + "                                                <gmd:linkage>\n" + "                                                    <gmd:URL>https://epsg.org/</gmd:URL>\n" + "                                                </gmd:linkage>\n" + "                                                <gmd:function>\n" + "                                                    <gmd:CI_OnLineFunctionCode codeList=\"http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode\" codeListValue=\"information\">Information</gmd:CI_OnLineFunctionCode>\n" + "                                                </gmd:function>\n" + "                                            </gmd:CI_OnlineResource>\n" + "                                        </gmd:onlineResource>\n" + "                                    </gmd:CI_Contact>\n" + "                                </gmd:contactInfo>\n" + "                                <gmd:role>" + '\n' + "                                    <gmd:CI_RoleCode codeList=\"http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode\" codeListValue=\"principalInvestigator\">Principal investigator</gmd:CI_RoleCode>" + '\n' + "                                </gmd:role>" + '\n' + "                            </gmd:CI_ResponsibleParty>" + '\n' + "                        </gmd:citedResponsibleParty>" + '\n' + "                        <gmd:presentationForm>" + '\n' + "                            <gmd:CI_PresentationFormCode codeList=\"http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_PresentationFormCode\" codeListValue=\"tableDigital\">Table digital</gmd:CI_PresentationFormCode>" + '\n' + "                        </gmd:presentationForm>" + '\n' + "                    </gmd:CI_Citation>" + '\n' + "                </gmd:specification>" + '\n' + "                <gmd:explanation>" + '\n' + "                    <gco:CharacterString>see the referenced specification</gco:CharacterString>" + '\n' + "                </gmd:explanation>" + '\n' + "                <gmd:pass>" + '\n' + "                    <gco:Boolean>true</gco:Boolean>" + '\n' + "                </gmd:pass>" + '\n' + "            </gmd:DQ_ConformanceResult>" + '\n' + "        </inspire_vs:Conformity>" + '\n' + "        <inspire_vs:MetadataPointOfContact>" + '\n' + "            <gmd:CI_ResponsibleParty>" + '\n' + "                <gmd:organisationName>" + '\n' + "                    <gco:CharacterString>International Association of Oil &amp; Gas Producers</gco:CharacterString>" + '\n' + "                </gmd:organisationName>" + '\n' + "                <gmd:contactInfo>\n" + "                    <gmd:CI_Contact>\n" + "                        <gmd:onlineResource>\n" + "                            <gmd:CI_OnlineResource>\n" + "                                <gmd:linkage>\n" + "                                    <gmd:URL>https://epsg.org/</gmd:URL>\n" + "                                </gmd:linkage>\n" + "                                <gmd:function>\n" + "                                    <gmd:CI_OnLineFunctionCode codeList=\"http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode\" codeListValue=\"information\">Information</gmd:CI_OnLineFunctionCode>\n" + "                                </gmd:function>\n" + "                            </gmd:CI_OnlineResource>\n" + "                        </gmd:onlineResource>\n" + "                    </gmd:CI_Contact>\n" + "                </gmd:contactInfo>\n" + "                <gmd:role>" + '\n' + "                    <gmd:CI_RoleCode codeList=\"http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode\" codeListValue=\"principalInvestigator\">Principal investigator</gmd:CI_RoleCode>" + '\n' + "                </gmd:role>" + '\n' + "            </gmd:CI_ResponsibleParty>" + '\n' + "        </inspire_vs:MetadataPointOfContact>" + '\n' + "        <inspire_vs:MetadataDate>" + '\n' + "            <gco:Date>1970-01-02</gco:Date>" + '\n' + "        </inspire_vs:MetadataDate>" + '\n' + "        <inspire_vs:SpatialDataService>" + '\n' + "            <srv:serviceType>" + '\n' + "                <gco:LocalName>view</gco:LocalName>" + '\n' + "            </srv:serviceType>" + '\n' + "        </inspire_vs:SpatialDataService>" + '\n' + "        <inspire_vs:InpireKeywords>" + '\n' + "            <gmd:keyword>" + '\n' + "                <gco:CharacterString>something</gco:CharacterString>" + '\n' + "            </gmd:keyword>" + '\n' + "        </inspire_vs:InpireKeywords>" + '\n' + "        <inspire_vs:Languages>" + '\n' + "            <inspire_vs:Language>FR</inspire_vs:Language>" + '\n' + "            <inspire_vs:Language default=\"true\">EN</inspire_vs:Language>" + '\n' + "        </inspire_vs:Languages>" + '\n' + "        <inspire_vs:currentLanguage>FR</inspire_vs:currentLanguage>" + '\n' + "    </inspire_vs:ExtendedCapabilities>" + '\n' + "</wms:Capability>" + '\n';
    // org.apache.sis.internal.jaxb.gml.GMLAdapter.IDs.removeUUID(period);
    assertXmlEquals(expResult, result, "http://www.w3.org/2000/xmlns:*");
}
Also used : LanguagesType(org.geotoolkit.inspire.xml.vs.LanguagesType) HashMap(java.util.HashMap) DefaultInternationalString(org.apache.sis.util.DefaultInternationalString) ArrayList(java.util.ArrayList) SimpleInternationalString(org.apache.sis.util.SimpleInternationalString) DefaultInternationalString(org.apache.sis.util.DefaultInternationalString) DefaultOnlineResource(org.apache.sis.metadata.iso.citation.DefaultOnlineResource) ExtendedCapabilitiesType(org.geotoolkit.inspire.xml.vs.ExtendedCapabilitiesType) LanguageType(org.geotoolkit.inspire.xml.vs.LanguageType) ObjectFactory(org.geotoolkit.inspire.xml.vs.ObjectFactory) DefaultExtent(org.apache.sis.metadata.iso.extent.DefaultExtent) StringWriter(java.io.StringWriter) ServiceType(org.geotoolkit.service.ServiceType) NamedIdentifier(org.apache.sis.referencing.NamedIdentifier) DefaultNameFactory(org.apache.sis.util.iso.DefaultNameFactory) DefaultTemporalExtent(org.apache.sis.metadata.iso.extent.DefaultTemporalExtent) DefaultConformanceResult(org.apache.sis.metadata.iso.quality.DefaultConformanceResult) Capability(org.geotoolkit.wms.xml.v130.Capability) DefaultInstant(org.geotoolkit.temporal.object.DefaultInstant) ResponsibleParty(org.opengis.metadata.citation.ResponsibleParty) DefaultResponsibleParty(org.apache.sis.metadata.iso.citation.DefaultResponsibleParty) Date(java.util.Date) DefaultKeywords(org.apache.sis.metadata.iso.identification.DefaultKeywords) DefaultPeriod(org.geotoolkit.temporal.object.DefaultPeriod) SimpleInternationalString(org.apache.sis.util.SimpleInternationalString) IdentifiedObject(org.opengis.referencing.IdentifiedObject) NameFactory(org.opengis.util.NameFactory) DefaultNameFactory(org.apache.sis.util.iso.DefaultNameFactory)

Example 4 with DefaultInstant

use of org.geotoolkit.temporal.object.DefaultInstant in project geotoolkit by Geomatys.

the class LandsatMetadataParser method getMetadata.

/**
 * Returns Landsat ISO19115 metadatas.
 */
public final DefaultMetadata getMetadata(final LandsatConstants.CoverageGroup group) throws FactoryException, ParseException {
    ArgumentChecks.ensureNonNull("Metadata group name", group);
    if (isoMetadata == null) {
        // generate metadata
        final DefaultMetadata baseMetadata = new DefaultMetadata();
        assert metaGroups != null;
        // ----------------------------------------------------------------------//
        // ------------------------ Mandatory metadata --------------------------//
        // ----------------------------------------------------------------------//
        // -- set CRS
        baseMetadata.setReferenceSystemInfo(Collections.singleton(getCRS()));
        final Date metadataPublicationDate = getDateInfo();
        if (metadataPublicationDate != null)
            baseMetadata.setDateStamp(metadataPublicationDate);
        // -- unique file identifier
        baseMetadata.setFileIdentifier(UUID.randomUUID().toString());
        // -- Iso metadatas 19115 generation date.
        baseMetadata.setDateStamp(new Date());
        // -- set bounding box
        final double[] bbCoords = getProjectedBound2D();
        final DefaultGeographicBoundingBox geo = new // -- long
        DefaultGeographicBoundingBox(// -- long
        bbCoords[0], // -- long
        bbCoords[1], bbCoords[2], // -- lat
        bbCoords[3]);
        // -- geographic extent
        final DefaultExtent ex = new DefaultExtent();
        ex.setGeographicElements(Arrays.asList(geo));
        // -- acquisition date
        final DefaultTemporalExtent tex = new DefaultTemporalExtent();
        final Date acquisitionDate = getAcquisitionDate();
        tex.setBounds(acquisitionDate, acquisitionDate);
        ex.setTemporalElements(Arrays.asList(tex));
        // -- temporal extent
        final NamedIdentifier extentName = new NamedIdentifier(null, "Landsat extent");
        final Map<String, Object> propertiesExtent = new HashMap<>();
        propertiesExtent.put(IdentifiedObject.NAME_KEY, extentName);
        final NamedIdentifier extentBeginName = new NamedIdentifier(null, "Landsat extent");
        final Map<String, Object> propertiesBegin = new HashMap<>();
        propertiesBegin.put(IdentifiedObject.NAME_KEY, extentBeginName);
        final NamedIdentifier extentEnd = new NamedIdentifier(null, "Landsat extent");
        final Map<String, Object> propertiesEnd = new HashMap<>();
        propertiesEnd.put(IdentifiedObject.NAME_KEY, extentEnd);
        tex.setExtent(new DefaultPeriod(propertiesExtent, new DefaultInstant(propertiesBegin, acquisitionDate), new DefaultInstant(propertiesEnd, acquisitionDate)));
        // -- Resolution
        final String reres = getValue(false, RESOLUTION_LABEL + group);
        final Set<Resolution> res = new HashSet<>();
        if (reres != null) {
            final DefaultResolution defaultResolution = new DefaultResolution();
            defaultResolution.setDistance(Double.valueOf(reres));
            res.add(defaultResolution);
        }
        /**
         * Three different Images Descriptions.
         * - Reflective
         * - Panchromatic
         * - Thermal
         */
        // -- Reflective description.
        final DefaultImageDescription reflectiveImgDesc = new DefaultImageDescription();
        final DefaultAttributeGroup dAGReflectiveRef = new DefaultAttributeGroup();
        dAGReflectiveRef.setAttributes(getBandsInfos(CoverageGroup.REFLECTIVE, "REFLECTANCE"));
        final DefaultAttributeGroup dAGReflectiveRad = new DefaultAttributeGroup();
        dAGReflectiveRad.setAttributes(getBandsInfos(CoverageGroup.REFLECTIVE, "RADIANCE"));
        final Set<AttributeGroup> reflectiveInfos = new HashSet<>();
        reflectiveInfos.add(dAGReflectiveRef);
        reflectiveInfos.add(dAGReflectiveRad);
        reflectiveImgDesc.setAttributeGroups(reflectiveInfos);
        // -- Panchromatic image description.
        final DefaultImageDescription panchroImgDesc = new DefaultImageDescription();
        final DefaultAttributeGroup dAGPanchromaRef = new DefaultAttributeGroup();
        dAGPanchromaRef.setAttributes(getBandsInfos(CoverageGroup.PANCHROMATIC, "REFLECTANCE"));
        final DefaultAttributeGroup dAGPanchromaRad = new DefaultAttributeGroup();
        dAGPanchromaRad.setAttributes(getBandsInfos(CoverageGroup.PANCHROMATIC, "RADIANCE"));
        final Set<AttributeGroup> panchroInfos = new HashSet<>();
        panchroInfos.add(dAGPanchromaRef);
        panchroInfos.add(dAGPanchromaRad);
        panchroImgDesc.setAttributeGroups(panchroInfos);
        // -- Thermal descriptions. (only define with Radiance)
        final DefaultImageDescription thermalImgDesc = new DefaultImageDescription();
        final DefaultAttributeGroup dAGThermalRad = new DefaultAttributeGroup();
        dAGThermalRad.setAttributes(getBandsInfos(CoverageGroup.THERMAL, "RADIANCE"));
        thermalImgDesc.setAttributeGroups(Collections.singleton(dAGThermalRad));
        // -- image description
        final String cloud = getValue(false, "CLOUD_COVER");
        if (cloud != null) {
            final double val = Double.valueOf(cloud);
            reflectiveImgDesc.setCloudCoverPercentage(val);
            panchroImgDesc.setCloudCoverPercentage(val);
            thermalImgDesc.setCloudCoverPercentage(val);
        }
        final String sunAz = getValue(false, "SUN_AZIMUTH");
        if (sunAz != null) {
            final double val = Double.valueOf(sunAz);
            reflectiveImgDesc.setIlluminationAzimuthAngle(val);
            panchroImgDesc.setIlluminationAzimuthAngle(val);
            thermalImgDesc.setIlluminationAzimuthAngle(val);
        }
        final String sunEl = getValue(false, "SUN_ELEVATION");
        if (sunEl != null) {
            final double val = Double.valueOf(sunEl);
            reflectiveImgDesc.setIlluminationElevationAngle(val);
            panchroImgDesc.setIlluminationElevationAngle(val);
            thermalImgDesc.setIlluminationElevationAngle(val);
        }
        // ----------------------------------------------------------------------//
        // ------------------------- optional metadatas -------------------------//
        // ----------------------------------------------------------------------//
        // -- set metadata Date publication
        baseMetadata.setDateInfo(Collections.singleton(new DefaultCitationDate(metadataPublicationDate, DateType.PUBLICATION)));
        // -- Distribution informations
        final DefaultDistribution distribution = new DefaultDistribution();
        final String origin = getValue(false, "ORIGIN");
        if (origin != null)
            distribution.setDescription(new DefaultInternationalString(origin));
        final String outputFormat = getValue(false, "OUTPUT_FORMAT");
        final String processSoftVersion = getValue(false, "PROCESSING_SOFTWARE_VERSION");
        if ((outputFormat != null) && (processSoftVersion != null)) {
            DefaultFormat f = new DefaultFormat();
            f.setName(new SimpleInternationalString(outputFormat));
            f.setVersion(new SimpleInternationalString(processSoftVersion));
            distribution.setDistributionFormats(Collections.singleton(f));
        }
        baseMetadata.setDistributionInfo(Collections.singleton(distribution));
        // -- Aquisition informations
        final DefaultAcquisitionInformation dAI = new DefaultAcquisitionInformation();
        // -- platform
        final DefaultPlatform platform = new DefaultPlatform();
        final String platF = getValue(false, "SPACECRAFT_ID");
        if (platF != null) {
            platform.setCitation(new DefaultCitation());
        }
        // -- instrument
        final DefaultInstrument instru = new DefaultInstrument();
        final String instrum = getValue(false, "SENSOR_ID");
        if (instrum != null) {
            instru.setType(new DefaultInternationalString(instrum));
        }
        if (platF != null && instrum != null) {
            // -- set related founded instrument and platform
            // *****************************************************************//
            // -- a cycle is define here, platform -> instru and instru -> platform
            // -- like a dad know his son and a son know his dad.
            // -- during xml binding a cycle is not supported for the current Apach SIS version
            // -- decomment this row when upgrade SIS version
            // instru.setMountedOn(platform);
            // *****************************************************************//
            platform.setInstruments(Collections.singleton(instru));
            dAI.setPlatforms(Collections.singleton(platform));
            dAI.setInstruments(Collections.singleton(instru));
            baseMetadata.setAcquisitionInformation(Collections.singleton(dAI));
        }
        // build each specific metadata
        isoMetadata = new DefaultMetadata(baseMetadata);
        panchromaticMetadatas = new DefaultMetadata(baseMetadata);
        reflectiveMetadatas = new DefaultMetadata(baseMetadata);
        thermalMetadatas = new DefaultMetadata(baseMetadata);
        // -- all minimum mandatory metadatas.
        // -- comment about data
        final InternationalString abstractComment = new DefaultInternationalString(getValue(true, "ORIGIN"));
        // -- dates
        final Set<DefaultCitationDate> dateset = new HashSet<>();
        dateset.add(new DefaultCitationDate(acquisitionDate, DateType.CREATION));
        dateset.add(new DefaultCitationDate(metadataPublicationDate, DateType.PUBLICATION));
        {
            // general metadata
            final NamedIdentifier identifier = CoverageGroup.ALL.createName(getValue(false, LandsatConstants.SCENE_ID));
            final DefaultCitation titleCitation = new DefaultCitation(identifier.toString());
            titleCitation.setIdentifiers(Collections.singleton(identifier));
            titleCitation.setDates(dateset);
            final DefaultDataIdentification ddii = new DefaultDataIdentification();
            ddii.setExtents(Arrays.asList(ex));
            ddii.setAbstract(abstractComment);
            ddii.setCitation(titleCitation);
            isoMetadata.setIdentificationInfo(Arrays.asList(ddii));
        }
        {
            // panchromatic
            final NamedIdentifier identifier = CoverageGroup.PANCHROMATIC.createName(getValue(false, LandsatConstants.SCENE_ID));
            final DefaultCitation titleCitation = new DefaultCitation(identifier.toString());
            titleCitation.setIdentifiers(Collections.singleton(identifier));
            titleCitation.setDates(dateset);
            final DefaultDataIdentification ddii = new DefaultDataIdentification();
            ddii.setExtents(Arrays.asList(ex));
            ddii.setAbstract(abstractComment);
            ddii.setCitation(titleCitation);
            ddii.setSpatialResolutions(res);
            panchromaticMetadatas.setIdentificationInfo(Arrays.asList(ddii));
            panchromaticMetadatas.setContentInfo(Arrays.asList(panchroImgDesc));
        }
        {
            // reflective
            final NamedIdentifier identifier = CoverageGroup.REFLECTIVE.createName(getValue(false, LandsatConstants.SCENE_ID));
            final DefaultCitation titleCitation = new DefaultCitation(identifier.toString());
            titleCitation.setIdentifiers(Collections.singleton(identifier));
            titleCitation.setDates(dateset);
            final DefaultDataIdentification ddii = new DefaultDataIdentification();
            ddii.setExtents(Arrays.asList(ex));
            ddii.setAbstract(abstractComment);
            ddii.setCitation(titleCitation);
            ddii.setSpatialResolutions(res);
            reflectiveMetadatas.setIdentificationInfo(Arrays.asList(ddii));
            reflectiveMetadatas.setContentInfo(Arrays.asList(reflectiveImgDesc));
        }
        {
            // thermal
            final NamedIdentifier identifier = CoverageGroup.THERMAL.createName(getValue(false, LandsatConstants.SCENE_ID));
            final DefaultCitation titleCitation = new DefaultCitation(identifier.toString());
            titleCitation.setIdentifiers(Collections.singleton(identifier));
            titleCitation.setDates(dateset);
            final DefaultDataIdentification ddii = new DefaultDataIdentification();
            ddii.setExtents(Arrays.asList(ex));
            ddii.setAbstract(abstractComment);
            ddii.setCitation(titleCitation);
            ddii.setSpatialResolutions(res);
            thermalMetadatas.setIdentificationInfo(Arrays.asList(ddii));
            thermalMetadatas.setContentInfo(Arrays.asList(thermalImgDesc));
            final Set<ProcessStep> extendedInfos = getThermicInfos();
            if (!extendedInfos.isEmpty()) {
                final DefaultLineage defaultLineage = new DefaultLineage();
                defaultLineage.setProcessSteps(extendedInfos);
                thermalMetadatas.setResourceLineages(Collections.singleton(defaultLineage));
            }
        }
    }
    switch(group) {
        case ALL:
            return isoMetadata;
        case PANCHROMATIC:
            return panchromaticMetadatas;
        case REFLECTIVE:
            return reflectiveMetadatas;
        case THERMAL:
            return thermalMetadatas;
        default:
            throw new IllegalArgumentException("Unknown coverage " + group);
    }
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) DefaultInternationalString(org.apache.sis.util.DefaultInternationalString) SimpleInternationalString(org.apache.sis.util.SimpleInternationalString) InternationalString(org.opengis.util.InternationalString) DefaultInternationalString(org.apache.sis.util.DefaultInternationalString) DefaultDistribution(org.apache.sis.metadata.iso.distribution.DefaultDistribution) DefaultAttributeGroup(org.apache.sis.metadata.iso.content.DefaultAttributeGroup) DefaultFormat(org.apache.sis.metadata.iso.distribution.DefaultFormat) DefaultExtent(org.apache.sis.metadata.iso.extent.DefaultExtent) DefaultAcquisitionInformation(org.apache.sis.metadata.iso.acquisition.DefaultAcquisitionInformation) NamedIdentifier(org.apache.sis.referencing.NamedIdentifier) DefaultTemporalExtent(org.apache.sis.metadata.iso.extent.DefaultTemporalExtent) DefaultDataIdentification(org.apache.sis.metadata.iso.identification.DefaultDataIdentification) DefaultPlatform(org.apache.sis.metadata.iso.acquisition.DefaultPlatform) HashSet(java.util.HashSet) DefaultResolution(org.apache.sis.metadata.iso.identification.DefaultResolution) DefaultMetadata(org.apache.sis.metadata.iso.DefaultMetadata) AttributeGroup(org.opengis.metadata.content.AttributeGroup) DefaultAttributeGroup(org.apache.sis.metadata.iso.content.DefaultAttributeGroup) DefaultInstant(org.geotoolkit.temporal.object.DefaultInstant) DefaultLineage(org.apache.sis.metadata.iso.lineage.DefaultLineage) Date(java.util.Date) DefaultCitationDate(org.apache.sis.metadata.iso.citation.DefaultCitationDate) DefaultImageDescription(org.apache.sis.metadata.iso.content.DefaultImageDescription) DefaultGeographicBoundingBox(org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox) DefaultPeriod(org.geotoolkit.temporal.object.DefaultPeriod) SimpleInternationalString(org.apache.sis.util.SimpleInternationalString) SimpleInternationalString(org.apache.sis.util.SimpleInternationalString) InternationalString(org.opengis.util.InternationalString) DefaultInternationalString(org.apache.sis.util.DefaultInternationalString) IdentifiedObject(org.opengis.referencing.IdentifiedObject) DefaultCitationDate(org.apache.sis.metadata.iso.citation.DefaultCitationDate) DefaultInstrument(org.apache.sis.metadata.iso.acquisition.DefaultInstrument) Resolution(org.opengis.metadata.identification.Resolution) DefaultResolution(org.apache.sis.metadata.iso.identification.DefaultResolution)

Example 5 with DefaultInstant

use of org.geotoolkit.temporal.object.DefaultInstant in project geotoolkit by Geomatys.

the class DefaultOrdinalEra method getStart.

/**
 * Returns a {@link TemporalNode} create from {@link #begin} object, use for XML binding.
 *
 * @return a {@link TemporalNode} create from {@link #begin} object, use for XML binding.
 */
@XmlElement(name = "start")
private DefaultTemporalNode getStart() {
    final Identifier iden = getName();
    final Map<String, Object> instantProp = new HashMap<>();
    instantProp.put(NAME_KEY, new NamedIdentifier(null, iden.getCode() + "_begin instant"));
    final Map<String, Object> nodeProp = new HashMap<>();
    nodeProp.put(NAME_KEY, new NamedIdentifier(null, iden.getCode() + "_start node"));
    final DefaultTemporalNode start = new DefaultTemporalNode(nodeProp, new DefaultInstant(instantProp, begin), null, null);
    return start;
}
Also used : NamedIdentifier(org.apache.sis.referencing.NamedIdentifier) Identifier(org.opengis.metadata.Identifier) HashMap(java.util.HashMap) NamedIdentifier(org.apache.sis.referencing.NamedIdentifier) DefaultInstant(org.geotoolkit.temporal.object.DefaultInstant) NilReferencingObject(org.apache.sis.internal.referencing.NilReferencingObject) AbstractIdentifiedObject(org.apache.sis.referencing.AbstractIdentifiedObject) DefaultTemporalNode(org.geotoolkit.temporal.object.DefaultTemporalNode) XmlElement(javax.xml.bind.annotation.XmlElement)

Aggregations

HashMap (java.util.HashMap)6 DefaultInstant (org.geotoolkit.temporal.object.DefaultInstant)6 NamedIdentifier (org.apache.sis.referencing.NamedIdentifier)5 IdentifiedObject (org.opengis.referencing.IdentifiedObject)4 Date (java.util.Date)3 DefaultExtent (org.apache.sis.metadata.iso.extent.DefaultExtent)3 DefaultTemporalExtent (org.apache.sis.metadata.iso.extent.DefaultTemporalExtent)3 DefaultInternationalString (org.apache.sis.util.DefaultInternationalString)3 SimpleInternationalString (org.apache.sis.util.SimpleInternationalString)3 DefaultPeriod (org.geotoolkit.temporal.object.DefaultPeriod)3 ArrayList (java.util.ArrayList)2 XmlElement (javax.xml.bind.annotation.XmlElement)2 NilReferencingObject (org.apache.sis.internal.referencing.NilReferencingObject)2 DefaultCitation (org.apache.sis.metadata.iso.citation.DefaultCitation)2 DefaultOnlineResource (org.apache.sis.metadata.iso.citation.DefaultOnlineResource)2 DefaultResponsibleParty (org.apache.sis.metadata.iso.citation.DefaultResponsibleParty)2 DefaultKeywords (org.apache.sis.metadata.iso.identification.DefaultKeywords)2 DefaultConformanceResult (org.apache.sis.metadata.iso.quality.DefaultConformanceResult)2 AbstractIdentifiedObject (org.apache.sis.referencing.AbstractIdentifiedObject)2 DefaultNameFactory (org.apache.sis.util.iso.DefaultNameFactory)2