Search in sources :

Example 1 with UPPER_CORNER

use of org.codice.ddf.registry.schemabindings.converter.web.SlotWebConverter.UPPER_CORNER in project ddf by codice.

the class SlotTypeConverter method getEnvelope.

private Optional<EnvelopeType> getEnvelope(Map<String, Object> envelopeMap) {
    Optional<EnvelopeType> optionalEnvelope = Optional.empty();
    if (MapUtils.isEmpty(envelopeMap)) {
        return optionalEnvelope;
    }
    optionalEnvelope = Optional.of(GML_FACTORY.createEnvelopeType());
    String valueToPopulate = MapUtils.getString(envelopeMap, SRS_NAME);
    if (StringUtils.isNotBlank(valueToPopulate)) {
        optionalEnvelope.get().setSrsName(valueToPopulate);
    }
    String upperCorner = MapUtils.getString(envelopeMap, UPPER_CORNER);
    String lowerCorner = MapUtils.getString(envelopeMap, LOWER_CORNER);
    if (StringUtils.isNotBlank(upperCorner)) {
        List<Double> values = Arrays.stream(StringUtils.split(upperCorner)).map(e -> new Double(e)).collect(Collectors.toList());
        DirectPositionType directPosition = GML_FACTORY.createDirectPositionType();
        directPosition.setValue(values);
        optionalEnvelope.get().setUpperCorner(directPosition);
    }
    if (StringUtils.isNotBlank(lowerCorner)) {
        List<Double> values = Arrays.stream(StringUtils.split(lowerCorner)).map(e -> new Double(e)).collect(Collectors.toList());
        DirectPositionType directPosition = GML_FACTORY.createDirectPositionType();
        directPosition.setValue(values);
        optionalEnvelope.get().setLowerCorner(directPosition);
    }
    return optionalEnvelope;
}
Also used : DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) Arrays(java.util.Arrays) StringUtils(org.apache.commons.lang.StringUtils) MapToSchemaElement(org.codice.ddf.registry.schemabindings.helper.MapToSchemaElement) WebMapHelper(org.codice.ddf.registry.schemabindings.helper.WebMapHelper) AnyValueType(net.opengis.cat.wrs.v_1_0_2.AnyValueType) POINT_KEY(org.codice.ddf.registry.schemabindings.converter.web.SlotWebConverter.POINT_KEY) LOWER_CORNER(org.codice.ddf.registry.schemabindings.converter.web.SlotWebConverter.LOWER_CORNER) EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) GML_FACTORY(org.codice.ddf.registry.schemabindings.EbrimConstants.GML_FACTORY) NAME(org.codice.ddf.registry.schemabindings.converter.web.SlotWebConverter.NAME) RIM_FACTORY(org.codice.ddf.registry.schemabindings.EbrimConstants.RIM_FACTORY) ENVELOPE_KEY(org.codice.ddf.registry.schemabindings.converter.web.SlotWebConverter.ENVELOPE_KEY) POSITION(org.codice.ddf.registry.schemabindings.converter.web.SlotWebConverter.POSITION) SRS_DIMENSION(org.codice.ddf.registry.schemabindings.converter.web.SlotWebConverter.SRS_DIMENSION) CollectionUtils(org.apache.commons.collections.CollectionUtils) Map(java.util.Map) RegistryConstants(org.codice.ddf.registry.common.RegistryConstants) BigInteger(java.math.BigInteger) WRS_FACTORY(org.codice.ddf.registry.schemabindings.EbrimConstants.WRS_FACTORY) SRS_NAME(org.codice.ddf.registry.schemabindings.converter.web.SlotWebConverter.SRS_NAME) UPPER_CORNER(org.codice.ddf.registry.schemabindings.converter.web.SlotWebConverter.UPPER_CORNER) ValueListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType) MapUtils(org.apache.commons.collections.MapUtils) Collectors(java.util.stream.Collectors) List(java.util.List) SLOT_TYPE(org.codice.ddf.registry.schemabindings.converter.web.SlotWebConverter.SLOT_TYPE) SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) VALUE(org.codice.ddf.registry.schemabindings.converter.web.SlotWebConverter.VALUE) PointType(net.opengis.gml.v_3_1_1.PointType) Optional(java.util.Optional) EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType)

Aggregations

BigInteger (java.math.BigInteger)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 AnyValueType (net.opengis.cat.wrs.v_1_0_2.AnyValueType)1 DirectPositionType (net.opengis.gml.v_3_1_1.DirectPositionType)1 EnvelopeType (net.opengis.gml.v_3_1_1.EnvelopeType)1 PointType (net.opengis.gml.v_3_1_1.PointType)1 SlotType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1)1 ValueListType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType)1 CollectionUtils (org.apache.commons.collections.CollectionUtils)1 MapUtils (org.apache.commons.collections.MapUtils)1 StringUtils (org.apache.commons.lang.StringUtils)1 RegistryConstants (org.codice.ddf.registry.common.RegistryConstants)1 GML_FACTORY (org.codice.ddf.registry.schemabindings.EbrimConstants.GML_FACTORY)1 RIM_FACTORY (org.codice.ddf.registry.schemabindings.EbrimConstants.RIM_FACTORY)1 WRS_FACTORY (org.codice.ddf.registry.schemabindings.EbrimConstants.WRS_FACTORY)1 ENVELOPE_KEY (org.codice.ddf.registry.schemabindings.converter.web.SlotWebConverter.ENVELOPE_KEY)1