Search in sources :

Example 6 with AbstractGeometryType

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

the class CswFilterFactory method createBinarySpatialOpTypeUsingGeometry.

@SuppressWarnings("unchecked")
private BinarySpatialOpType createBinarySpatialOpTypeUsingGeometry(PropertyNameType propertyName, JAXBElement<? extends AbstractGeometryType> geometry) {
    BinarySpatialOpType binarySpatialOpType = new BinarySpatialOpType();
    binarySpatialOpType.setPropertyName(propertyName);
    binarySpatialOpType.setGeometry((JAXBElement<AbstractGeometryType>) geometry);
    return binarySpatialOpType;
}
Also used : AbstractGeometryType(net.opengis.gml.v_3_1_1.AbstractGeometryType) BinarySpatialOpType(net.opengis.filter.v_1_1_0.BinarySpatialOpType)

Example 7 with AbstractGeometryType

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

the class CswFilterFactory method createBinarySpatialOpType.

private BinarySpatialOpType createBinarySpatialOpType(PropertyNameType propertyName, String wkt, BinarySpatialOperand geometryOrEnvelope) {
    BinarySpatialOpType binarySpatialOpType = null;
    if (geometryOrEnvelope == BinarySpatialOperand.GEOMETRY) {
        wkt = convertWktToLatLonOrdering(wkt);
        Geometry geometry = getGeometryFromWkt(wkt);
        JAXBElement<? extends AbstractGeometryType> geometryJaxbElement = convertGeometry(geometry);
        binarySpatialOpType = createBinarySpatialOpTypeUsingGeometry(propertyName, geometryJaxbElement);
    } else {
        JAXBElement<EnvelopeType> envelopeJaxbElement = createEnvelopeType(wkt);
        binarySpatialOpType = createBinarySpatialOpTypeUsingEnvelope(propertyName, envelopeJaxbElement);
    }
    return binarySpatialOpType;
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) BinarySpatialOpType(net.opengis.filter.v_1_1_0.BinarySpatialOpType)

Example 8 with AbstractGeometryType

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

the class GeometryAdapter method unmarshalFrom.

public static Attribute unmarshalFrom(GeometryElement element) throws ConversionFailedException {
    AttributeImpl attribute = null;
    GML311ToJTSGeometryConverter converter = new GML311ToJTSGeometryConverter();
    WKTWriter wktWriter = new WKTWriter();
    for (Value xmlValue : element.getValue()) {
        JAXBElement<AbstractGeometryType> xmlGeometry = xmlValue.getGeometry();
        Geometry geometry = converter.createGeometry(new DefaultRootObjectLocator(xmlValue), xmlGeometry.getValue());
        String wkt = wktWriter.write(geometry);
        if (attribute == null) {
            attribute = new AttributeImpl(element.getName(), wkt);
        } else {
            attribute.addValue(wkt);
        }
    }
    return attribute;
}
Also used : GML311ToJTSGeometryConverter(org.jvnet.ogc.gml.v_3_1_1.jts.GML311ToJTSGeometryConverter) Geometry(com.vividsolutions.jts.geom.Geometry) WKTWriter(com.vividsolutions.jts.io.WKTWriter) DefaultRootObjectLocator(org.jvnet.jaxb2_commons.locator.DefaultRootObjectLocator) AbstractGeometryType(net.opengis.gml.v_3_1_1.AbstractGeometryType) AttributeImpl(ddf.catalog.data.impl.AttributeImpl) Value(ddf.catalog.transformer.xml.binding.GeometryElement.Value)

Aggregations

AbstractGeometryType (net.opengis.gml.v_3_1_1.AbstractGeometryType)7 Geometry (com.vividsolutions.jts.geom.Geometry)4 JAXBElement (javax.xml.bind.JAXBElement)3 WKTWriter (com.vividsolutions.jts.io.WKTWriter)2 Value (ddf.catalog.transformer.xml.binding.GeometryElement.Value)2 BinarySpatialOpType (net.opengis.filter.v_1_1_0.BinarySpatialOpType)2 DefaultRootObjectLocator (org.jvnet.jaxb2_commons.locator.DefaultRootObjectLocator)2 GML311ToJTSGeometryConverter (org.jvnet.ogc.gml.v_3_1_1.jts.GML311ToJTSGeometryConverter)2 Coordinate (com.vividsolutions.jts.geom.Coordinate)1 ParseException (com.vividsolutions.jts.io.ParseException)1 WKTReader (com.vividsolutions.jts.io.WKTReader)1 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)1 CatalogTransformerException (ddf.catalog.transform.CatalogTransformerException)1 GeometryElement (ddf.catalog.transformer.xml.binding.GeometryElement)1 ValidationExceptionImpl (ddf.catalog.validation.impl.ValidationExceptionImpl)1 Serializable (java.io.Serializable)1 ArrayList (java.util.ArrayList)1 QName (javax.xml.namespace.QName)1 AnyValueType (net.opengis.cat.wrs.v_1_0_2.AnyValueType)1 DistanceBufferType (net.opengis.filter.v_1_1_0.DistanceBufferType)1