Search in sources :

Example 1 with AbstractGeometryType

use of net.opengis.gml.x32.AbstractGeometryType in project ddf by codice.

the class RegistryPackageConverter method setSlotGeoAttribute.

private static void setSlotGeoAttribute(SlotType1 slot, String metacardAttributeName, MetacardImpl metacard) throws RegistryConversionException {
    if (slot.isSetValueList()) {
        net.opengis.cat.wrs.v_1_0_2.ValueListType valueList = (net.opengis.cat.wrs.v_1_0_2.ValueListType) slot.getValueList().getValue();
        List<AnyValueType> anyValues = valueList.getAnyValue();
        for (AnyValueType anyValue : anyValues) {
            if (anyValue.isSetContent()) {
                for (Object content : anyValue.getContent()) {
                    if (content instanceof JAXBElement) {
                        JAXBElement jaxbElement = (JAXBElement) content;
                        AbstractGeometryType geometry = (AbstractGeometryType) jaxbElement.getValue();
                        String convertedGeometry = getWKTFromGeometry(geometry, jaxbElement);
                        if (StringUtils.isNotBlank(convertedGeometry)) {
                            metacard.setAttribute(metacardAttributeName, convertedGeometry);
                        }
                    }
                }
            }
        }
    }
}
Also used : AbstractGeometryType(net.opengis.gml.v_3_1_1.AbstractGeometryType) JAXBElement(javax.xml.bind.JAXBElement) AnyValueType(net.opengis.cat.wrs.v_1_0_2.AnyValueType)

Example 2 with AbstractGeometryType

use of net.opengis.gml.x32.AbstractGeometryType in project arctic-sea by 52North.

the class GmlEncoderv321 method createGeomteryPropertyType.

private XmlObject createGeomteryPropertyType(AbstractGeometry element, EncodingContext ctx) throws EncodingException {
    GeometryPropertyType geometryPropertyType = GeometryPropertyType.Factory.newInstance();
    if (element.isReferenced()) {
        geometryPropertyType.setHref(element.getGmlId());
    } else {
        AbstractGeometryType xmlObject = createAbstractGeometry(element, ctx);
        geometryPropertyType.setAbstractGeometry(xmlObject);
        XmlHelper.substituteElement(geometryPropertyType.getAbstractGeometry(), xmlObject);
    }
    return geometryPropertyType;
}
Also used : AbstractGeometryType(net.opengis.gml.x32.AbstractGeometryType) GeometryPropertyType(net.opengis.gml.x32.GeometryPropertyType)

Example 3 with AbstractGeometryType

use of net.opengis.gml.x32.AbstractGeometryType in project ddf by codice.

the class CswQueryFactoryTest method createPolygon.

private JAXBElement<AbstractGeometryType> createPolygon() {
    PolygonType localPolygon = new PolygonType();
    LinearRingType ring = new LinearRingType();
    for (Coordinate coordinate : polygon.getCoordinates()) {
        CoordType coord = new CoordType();
        coord.setX(BigDecimal.valueOf(coordinate.x));
        coord.setY(BigDecimal.valueOf(coordinate.y));
        if (!Double.isNaN(coordinate.z)) {
            coord.setZ(BigDecimal.valueOf(coordinate.z));
        }
        ring.getCoord().add(coord);
    }
    AbstractRingPropertyType abstractRing = new AbstractRingPropertyType();
    abstractRing.setRing(gmlObjectFactory.createLinearRing(ring));
    localPolygon.setExterior(gmlObjectFactory.createExterior(abstractRing));
    JAXBElement<AbstractGeometryType> agt = new JAXBElement<>(new QName("http://www.opengis.net/gml", "Polygon"), AbstractGeometryType.class, null, localPolygon);
    return agt;
}
Also used : Coordinate(org.locationtech.jts.geom.Coordinate) AbstractGeometryType(net.opengis.gml.v_3_1_1.AbstractGeometryType) LinearRingType(net.opengis.gml.v_3_1_1.LinearRingType) AbstractRingPropertyType(net.opengis.gml.v_3_1_1.AbstractRingPropertyType) QName(javax.xml.namespace.QName) PolygonType(net.opengis.gml.v_3_1_1.PolygonType) JAXBElement(javax.xml.bind.JAXBElement) CoordType(net.opengis.gml.v_3_1_1.CoordType)

Example 4 with AbstractGeometryType

use of net.opengis.gml.x32.AbstractGeometryType in project ddf by codice.

the class CswFilterFactory method createDistanceBufferType.

@SuppressWarnings("unchecked")
private DistanceBufferType createDistanceBufferType(PropertyNameType propertyName, JAXBElement<? extends AbstractGeometryType> geometry, DistanceType distance) {
    DistanceBufferType distanceBuffer = new DistanceBufferType();
    distanceBuffer.setDistance(distance);
    distanceBuffer.setGeometry((JAXBElement<AbstractGeometryType>) geometry);
    distanceBuffer.setPropertyName(propertyName);
    return distanceBuffer;
}
Also used : AbstractGeometryType(net.opengis.gml.v_3_1_1.AbstractGeometryType) DistanceBufferType(net.opengis.filter.v_1_1_0.DistanceBufferType)

Example 5 with AbstractGeometryType

use of net.opengis.gml.x32.AbstractGeometryType in project ddf by codice.

the class WfsFilterDelegate method buildDistanceBufferType.

@SuppressWarnings("unchecked")
private JAXBElement<DistanceBufferType> buildDistanceBufferType(JAXBElement<DistanceBufferType> dbt, String propertyName, String wkt, double distance) {
    DistanceType distanceType = new DistanceType();
    distanceType.setValue(distance);
    // the filter adapter normalizes all distances to meters
    distanceType.setUnits(WfsConstants.METERS);
    dbt.getValue().setDistance(distanceType);
    dbt.getValue().setGeometry((JAXBElement<AbstractGeometryType>) createGeometryOperand(wkt));
    dbt.getValue().setPropertyName(createPropertyNameType(propertyName).getValue());
    return dbt;
}
Also used : AbstractGeometryType(net.opengis.gml.v_3_1_1.AbstractGeometryType) DistanceType(net.opengis.filter.v_1_1_0.DistanceType)

Aggregations

AbstractGeometryType (net.opengis.gml.v_3_1_1.AbstractGeometryType)7 JAXBElement (javax.xml.bind.JAXBElement)3 Value (ddf.catalog.transformer.xml.binding.GeometryElement.Value)2 AbstractGeometryType (net.opengis.gml.x32.AbstractGeometryType)2 GeometryPropertyType (net.opengis.gml.x32.GeometryPropertyType)2 Geometry (org.locationtech.jts.geom.Geometry)2 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)1 CatalogTransformerException (ddf.catalog.transform.CatalogTransformerException)1 GeometryElement (ddf.catalog.transformer.xml.binding.GeometryElement)1 Serializable (java.io.Serializable)1 QName (javax.xml.namespace.QName)1 AnyValueType (net.opengis.cat.wrs.v_1_0_2.AnyValueType)1 BinarySpatialOpType (net.opengis.filter.v_1_1_0.BinarySpatialOpType)1 DistanceBufferType (net.opengis.filter.v_1_1_0.DistanceBufferType)1 DistanceType (net.opengis.filter.v_1_1_0.DistanceType)1 AbstractRingPropertyType (net.opengis.gml.v_3_1_1.AbstractRingPropertyType)1 CoordType (net.opengis.gml.v_3_1_1.CoordType)1 LinearRingType (net.opengis.gml.v_3_1_1.LinearRingType)1 PolygonType (net.opengis.gml.v_3_1_1.PolygonType)1 XmlObject (org.apache.xmlbeans.XmlObject)1