Search in sources :

Example 11 with EnvelopeType

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

the class WfsFilterDelegateTest method testIntersectsAsBoundingBox.

@Test
public void testIntersectsAsBoundingBox() {
    WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BBOX.getValue(), new LonLatCoordinateStrategy());
    FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
    assertThat(filter.getSpatialOps().getValue(), is(instanceOf(BBOXType.class)));
    assertThat(filter.isSetLogicOps(), is(false));
    BBOXType bboxType = (BBOXType) filter.getSpatialOps().getValue();
    EnvelopeType envelope = bboxType.getEnvelope().getValue();
    DirectPositionType lowerCorner = envelope.getLowerCorner();
    assertThat("The bounding box's lower corner was null.", lowerCorner, is(notNullValue()));
    assertThat(lowerCorner.getValue(), is(asList(10.0, -10.0)));
    DirectPositionType upperCorner = envelope.getUpperCorner();
    assertThat("The bounding box's upper corner was null.", upperCorner, is(notNullValue()));
    assertThat(upperCorner.getValue(), is(asList(40.0, 30.0)));
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) BBOXType(net.opengis.filter.v_1_1_0.BBOXType) DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) Test(org.junit.Test)

Example 12 with EnvelopeType

use of net.opengis.gml.v_3_1_1.EnvelopeType 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(org.locationtech.jts.geom.Geometry) EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) BinarySpatialOpType(net.opengis.filter.v_1_1_0.BinarySpatialOpType)

Example 13 with EnvelopeType

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

the class CswFilterFactory method createBBoxType.

private JAXBElement<BBOXType> createBBoxType(String propertyName, String wkt) {
    BBOXType bboxType = new BBOXType();
    JAXBElement<EnvelopeType> envelope = createEnvelopeType(wkt);
    bboxType.setEnvelope(envelope);
    bboxType.setPropertyName(createPropertyNameType(propertyName));
    return filterObjectFactory.createBBOX(bboxType);
}
Also used : EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) BBOXType(net.opengis.filter.v_1_1_0.BBOXType)

Example 14 with EnvelopeType

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

the class CswFilterFactory method createEnvelopeType.

private JAXBElement<EnvelopeType> createEnvelopeType(String wkt) {
    EnvelopeType envelopeType = new EnvelopeType();
    wkt = convertWktToLatLonOrdering(wkt);
    Envelope envelope = getEnvelopeFromWkt(wkt);
    if (envelope != null) {
        envelopeType.setLowerCorner(createDirectPositionType(envelope.getMinX(), envelope.getMinY()));
        envelopeType.setUpperCorner(createDirectPositionType(envelope.getMaxX(), envelope.getMaxY()));
    }
    return gmlObjectFactory.createEnvelope(envelopeType);
}
Also used : EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) Envelope(org.locationtech.jts.geom.Envelope)

Example 15 with EnvelopeType

use of net.opengis.gml.v_3_1_1.EnvelopeType in project arctic-sea by 52North.

the class GmlEncoderv321 method createEnvelope.

private XmlObject createEnvelope(ReferencedEnvelope sosEnvelope) {
    int srid = sosEnvelope.getSrid();
    EnvelopeType envelopeType = EnvelopeType.Factory.newInstance();
    MinMax<String> minmax = sosEnvelope.getMinMaxFromEnvelope();
    envelopeType.addNewLowerCorner().setStringValue(minmax.getMinimum());
    envelopeType.addNewUpperCorner().setStringValue(minmax.getMaximum());
    envelopeType.setSrsName(getSrsName(srid));
    return envelopeType;
}
Also used : EnvelopeType(net.opengis.gml.x32.EnvelopeType) MultiLineString(org.locationtech.jts.geom.MultiLineString) LineString(org.locationtech.jts.geom.LineString) MultiPoint(org.locationtech.jts.geom.MultiPoint) Point(org.locationtech.jts.geom.Point)

Aggregations

EnvelopeType (net.opengis.gml.v_3_1_1.EnvelopeType)11 DirectPositionType (net.opengis.gml.v_3_1_1.DirectPositionType)8 BBOXType (net.opengis.filter.v_1_1_0.BBOXType)6 AnyValueType (net.opengis.cat.wrs.v_1_0_2.AnyValueType)4 FilterType (net.opengis.filter.v_1_1_0.FilterType)4 PointType (net.opengis.gml.v_3_1_1.PointType)4 Test (org.junit.Test)4 Map (java.util.Map)3 EnvelopeType (net.opengis.swe.x101.EnvelopeType)3 SlotType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1)3 Envelope (org.locationtech.jts.geom.Envelope)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2 ValueListType (net.opengis.cat.wrs.v_1_0_2.ValueListType)2 ValueListType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType)2 MapUtils (org.apache.commons.collections.MapUtils)2 StringUtils (org.apache.commons.lang.StringUtils)2 XmlObject (org.apache.xmlbeans.XmlObject)2