Search in sources :

Example 26 with EnvelopeType

use of org.geotoolkit.gml.xml.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 27 with EnvelopeType

use of org.geotoolkit.gml.xml.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 28 with EnvelopeType

use of org.geotoolkit.gml.xml.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)

Example 29 with EnvelopeType

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

the class AreaSearchRequestFilter method createEnvelope.

/**
 * @param bbox
 * @return {@link EnvelopeType}
 */
private EnvelopeType createEnvelope(BBox bbox) {
    EnvelopeType envelope = new EnvelopeType();
    DirectPositionType lower = new DirectPositionType();
    lower.setValue(Arrays.asList(bbox.getMinX(), bbox.getMinY()));
    envelope.setLowerCorner(lower);
    DirectPositionType upper = new DirectPositionType();
    upper.setValue(Arrays.asList(bbox.getMaxX(), bbox.getMaxY()));
    envelope.setUpperCorner(upper);
    return envelope;
}
Also used : EnvelopeType(org.geosdi.geoplatform.xml.gml.v311.EnvelopeType) DirectPositionType(org.geosdi.geoplatform.xml.gml.v311.DirectPositionType)

Example 30 with EnvelopeType

use of org.geotoolkit.gml.xml.v311.EnvelopeType in project geotoolkit by Geomatys.

the class FilterFactoryImpl method GeometryToGML.

/**
 * Transform a JTS geometric object into a GML marshallable object
 */
public Object GeometryToGML(final Object geom) {
    Object result = null;
    if (geom instanceof Polygon) {
        final Polygon p = (Polygon) geom;
        final Coordinate[] coord = p.getCoordinates();
        // an envelope
        if (coord.length == 5) {
            final DirectPositionType lowerCorner = new DirectPositionType(coord[0].y, coord[0].x);
            final DirectPositionType upperCorner = new DirectPositionType(coord[2].y, coord[2].x);
            result = new EnvelopeType(null, lowerCorner, upperCorner, "EPSG:4326");
        }
    } else if (geom instanceof Point) {
        final Point p = (Point) geom;
        final Coordinate[] coord = p.getCoordinates();
        result = new PointType(null, new DirectPositionType(coord[0].x, coord[0].y, coord[0].z));
        ((PointType) result).setSrsName("EPSG:4326");
    } else if (geom instanceof LineString) {
        final LineString ls = (LineString) geom;
        final Coordinate[] coord = ls.getCoordinates();
        result = new LineStringType(new CoordinatesType(coord[0].x + "," + coord[0].y + " " + coord[1].x + "," + coord[1].y));
        ((LineStringType) result).setSrsName("EPSG:4326");
    } else {
        LOGGER.severe("unable to create GML geometry with: " + geom.getClass().getSimpleName());
    }
    return result;
}
Also used : EnvelopeType(org.geotoolkit.gml.xml.v311.EnvelopeType) DirectPositionType(org.geotoolkit.gml.xml.v311.DirectPositionType) Coordinate(org.locationtech.jts.geom.Coordinate) LineString(org.locationtech.jts.geom.LineString) PointType(org.geotoolkit.gml.xml.v311.PointType) Point(org.locationtech.jts.geom.Point) Polygon(org.locationtech.jts.geom.Polygon) LineStringType(org.geotoolkit.gml.xml.v311.LineStringType) CoordinatesType(org.geotoolkit.gml.xml.v311.CoordinatesType)

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