Search in sources :

Example 31 with EnvelopeType

use of org.geosdi.geoplatform.xml.gml.v311.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 32 with EnvelopeType

use of org.geosdi.geoplatform.xml.gml.v311.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)

Example 33 with EnvelopeType

use of org.geosdi.geoplatform.xml.gml.v311.EnvelopeType in project arctic-sea by 52North.

the class SweCommonEncoderv101 method createField.

private DataComponentPropertyType createField(SweField sweField) throws EncodingException {
    SweAbstractDataComponent element = sweField.getElement();
    DataComponentPropertyType xbField = DataComponentPropertyType.Factory.newInstance(getXmlOptions());
    if (sweField.isSetName()) {
        xbField.setName(sweField.getName().getValue());
    }
    if (element instanceof SweBoolean) {
        xbField.addNewBoolean().set(createSimpleType((SweBoolean) element));
    } else if (element instanceof SweCategory) {
        xbField.addNewCategory().set(createSimpleType((SweCategory) element));
    } else if (element instanceof SweCount) {
        xbField.addNewCount().set(createSimpleType((SweCount) element));
    } else if (element instanceof SweCountRange) {
        xbField.addNewCount().set(createSimpleType((SweCountRange) element));
    } else if (element instanceof SweQuantity) {
        xbField.addNewQuantity().set(createSimpleType((SweQuantity) element));
    } else if (element instanceof SweQuantityRange) {
        xbField.addNewQuantity().set(createSimpleType((SweQuantityRange) element));
    } else if (element instanceof SweText) {
        xbField.addNewText().set(createSimpleType((SweText) element));
    } else if (element instanceof SweTimeRange) {
        xbField.addNewTimeRange().set(createSimpleType((SweTimeRange) element));
    } else if (element instanceof SweTime) {
        xbField.addNewTime().set(createSimpleType((SweTime) element));
    } else if (element instanceof SweEnvelope) {
        EnvelopeType xbEnvelope = (EnvelopeType) xbField.addNewAbstractDataRecord().substitute(SweConstants.QN_ENVELOPE_SWE_101, EnvelopeType.type);
        xbEnvelope.set(createEnvelope((SweEnvelope) element));
    } else if (element instanceof SweDataRecord) {
        DataRecordType xbEnvelope = (DataRecordType) xbField.addNewAbstractDataRecord().substitute(SweConstants.QN_DATA_RECORD_SWE_101, DataRecordType.type);
        xbEnvelope.set(createDataRecord((SweDataRecord) element));
    } else if (element instanceof SweDataArray) {
        DataArrayType xbEnvelope = (DataArrayType) xbField.addNewAbstractDataRecord().substitute(SweConstants.QN_DATA_RECORD_SWE_101, DataArrayType.type);
        xbEnvelope.set(createDataArray((SweDataArray) element).getDataArray1());
    } else {
        throw new EncodingException("The element type '%s' of the received '%s' is not supported by this encoder '%s'.", new Object[] { element != null ? element.getClass().getName() : null, sweField.getClass().getName(), getClass().getName() });
    }
    return xbField;
}
Also used : SweQuantity(org.n52.shetland.ogc.swe.simpleType.SweQuantity) DataRecordType(net.opengis.swe.x101.DataRecordType) SimpleDataRecordType(net.opengis.swe.x101.SimpleDataRecordType) SweText(org.n52.shetland.ogc.swe.simpleType.SweText) SweTime(org.n52.shetland.ogc.swe.simpleType.SweTime) EnvelopeType(net.opengis.swe.x101.EnvelopeType) EncodingException(org.n52.svalbard.encode.exception.EncodingException) NotYetSupportedEncodingException(org.n52.svalbard.encode.exception.NotYetSupportedEncodingException) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) SweCountRange(org.n52.shetland.ogc.swe.simpleType.SweCountRange) SweCount(org.n52.shetland.ogc.swe.simpleType.SweCount) SweTimeRange(org.n52.shetland.ogc.swe.simpleType.SweTimeRange) SweDataArray(org.n52.shetland.ogc.swe.SweDataArray) SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean) SweQuantityRange(org.n52.shetland.ogc.swe.simpleType.SweQuantityRange) SweEnvelope(org.n52.shetland.ogc.swe.SweEnvelope) SweDataRecord(org.n52.shetland.ogc.swe.SweDataRecord) SweCategory(org.n52.shetland.ogc.swe.simpleType.SweCategory) DataComponentPropertyType(net.opengis.swe.x101.DataComponentPropertyType) XmlObject(org.apache.xmlbeans.XmlObject) DataArrayType(net.opengis.swe.x101.DataArrayType)

Example 34 with EnvelopeType

use of org.geosdi.geoplatform.xml.gml.v311.EnvelopeType in project arctic-sea by 52North.

the class SweCommonEncoderv101 method createEnvelope.

private EnvelopeType createEnvelope(SweEnvelope sosSweEnvelope) throws EncodingException {
    EnvelopeType envelopeType = EnvelopeType.Factory.newInstance(getXmlOptions());
    addAbstractDataComponentValues(envelopeType, sosSweEnvelope);
    if (sosSweEnvelope.isReferenceFrameSet()) {
        envelopeType.setReferenceFrame(sosSweEnvelope.getReferenceFrame());
    }
    if (sosSweEnvelope.isLowerCornerSet()) {
        envelopeType.setLowerCorner(createVectorProperty(sosSweEnvelope.getLowerCorner()));
    }
    if (sosSweEnvelope.isUpperCornerSet()) {
        envelopeType.setUpperCorner(createVectorProperty(sosSweEnvelope.getUpperCorner()));
    }
    if (sosSweEnvelope.isTimeSet()) {
        envelopeType.addNewTime().setTimeRange(createTimeRange(sosSweEnvelope.getTime()));
    }
    return envelopeType;
}
Also used : EnvelopeType(net.opengis.swe.x101.EnvelopeType)

Example 35 with EnvelopeType

use of org.geosdi.geoplatform.xml.gml.v311.EnvelopeType in project geo-platform by geosdi.

the class WFSGetFeatureRequestV110 method createAreaOperator.

/**
 * @param bbox
 * @return {@link JAXBElement<BBOXType>}
 */
private JAXBElement<BBOXType> createAreaOperator(BBox bbox) {
    logger.debug("#######################BBOX : {}\n.", bbox);
    BBOXType bBoxType = new BBOXType();
    PropertyNameType propertyNameType = new PropertyNameType();
    propertyNameType.setContent(asList(super.getGeometryName()));
    bBoxType.setPropertyName(propertyNameType);
    EnvelopeType envelope = this.createEnvelope(bbox);
    if (srs != null) {
        envelope.setSrsName(srs);
    }
    bBoxType.setEnvelope(gmlFactory.createEnvelope(envelope));
    return filterFactory.createBBOX(bBoxType);
}
Also used : EnvelopeType(org.geosdi.geoplatform.xml.gml.v311.EnvelopeType) BBOXType(org.geosdi.geoplatform.xml.filter.v110.BBOXType) PropertyNameType(org.geosdi.geoplatform.xml.filter.v110.PropertyNameType)

Aggregations

EnvelopeType (net.opengis.gml.v_3_1_1.EnvelopeType)11 EnvelopeType (org.geotoolkit.gml.xml.v311.EnvelopeType)11 DirectPositionType (org.geotoolkit.gml.xml.v311.DirectPositionType)9 JAXBElement (javax.xml.bind.JAXBElement)8 DirectPositionType (net.opengis.gml.v_3_1_1.DirectPositionType)8 BBOXType (net.opengis.filter.v_1_1_0.BBOXType)6 Test (org.junit.Test)6 Envelope (org.locationtech.jts.geom.Envelope)6 ArrayList (java.util.ArrayList)5 EnvelopeType (org.geosdi.geoplatform.xml.gml.v311.EnvelopeType)5 StringWriter (java.io.StringWriter)4 List (java.util.List)4 FilterType (net.opengis.filter.v_1_1_0.FilterType)4 AnyValueType (net.opengis.cat.wrs.v_1_0_2.AnyValueType)3 PointType (net.opengis.gml.v_3_1_1.PointType)3 EnvelopeType (net.opengis.swe.x101.EnvelopeType)3 EnvelopeType (org.geotoolkit.gml.xml.v321.EnvelopeType)3 OverlapsType (org.geotoolkit.ogc.xml.v110.OverlapsType)3 PropertyNameType (org.geotoolkit.ogc.xml.v110.PropertyNameType)3 Geometry (org.locationtech.jts.geom.Geometry)3