Search in sources :

Example 1 with LineStringType

use of ogc.schema.opengis.gml.v_2_1_2.LineStringType in project ddf by codice.

the class WfsFilterDelegate method createLineString.

private JAXBElement<LineStringType> createLineString(Geometry geometry) {
    LineStringType lineStringType = gml320ObjectFactory.createLineStringType();
    lineStringType.setSrsName(GeospatialUtil.EPSG_4326_URN);
    lineStringType.setCoordinates(createCoordinates(geometry));
    return gml320ObjectFactory.createLineString(lineStringType);
}
Also used : LineStringType(net.opengis.gml.v_3_2_1.LineStringType)

Example 2 with LineStringType

use of ogc.schema.opengis.gml.v_2_1_2.LineStringType in project ddf by codice.

the class Wfs20JTStoGML321Converter method convertToRingType.

public static RingType convertToRingType(LinearRing line, String srsName) {
    RingType ringType = GML320_OBJECT_FACTORY.createRingType();
    CurvePropertyType curvePropertyType = GML320_OBJECT_FACTORY.createCurvePropertyType();
    LineStringType curve = convertToLineStringType(line, srsName);
    JAXBElement<LineStringType> lineStringTypeJAXBElement = GML320_OBJECT_FACTORY.createLineString(curve);
    curvePropertyType.setAbstractCurve(lineStringTypeJAXBElement);
    ringType.getCurveMember().add(curvePropertyType);
    return ringType;
}
Also used : CurvePropertyType(net.opengis.gml.v_3_2_1.CurvePropertyType) LineStringType(net.opengis.gml.v_3_2_1.LineStringType) RingType(net.opengis.gml.v_3_2_1.RingType)

Example 3 with LineStringType

use of ogc.schema.opengis.gml.v_2_1_2.LineStringType in project ddf by codice.

the class Wfs20JTStoGML321Converter method createGeometryPropertyType.

private static GeometryPropertyType createGeometryPropertyType(Geometry geometry, String srsName) {
    final GeometryPropertyType geometryPropertyType = GML320_OBJECT_FACTORY.createGeometryPropertyType();
    if (geometry instanceof Point) {
        PointType pointType = convertToPointType((Point) geometry, srsName);
        geometryPropertyType.setAbstractGeometry(convertPointTypeToJAXB(pointType));
    } else if (geometry instanceof LineString) {
        LineStringType lineStringType = convertToLineStringType((LineString) geometry, srsName);
        geometryPropertyType.setAbstractGeometry(convertLineStringTypeToJAXB(lineStringType));
    } else if (geometry instanceof Polygon) {
        PolygonType polygonType = convertToPolygonType((Polygon) geometry, srsName);
        geometryPropertyType.setAbstractGeometry(convertPolygonTypeToJAXB(polygonType));
    } else if (geometry instanceof MultiPoint) {
        MultiPointType multiPointType = convertToMultiPointType((MultiPoint) geometry, srsName);
        geometryPropertyType.setAbstractGeometry(convertMultiPointTypeToJAXB(multiPointType));
    } else if (geometry instanceof MultiLineString) {
        MultiCurveType multiCurveType = convertToMultiLineStringType((MultiLineString) geometry, srsName);
        geometryPropertyType.setAbstractGeometry(convertMultiCurveTypeToJAXB(multiCurveType));
    } else if (geometry instanceof MultiPolygon) {
        MultiSurfaceType multiSurfaceType = convertToMultiSurfaceType((MultiPolygon) geometry, srsName);
        geometryPropertyType.setAbstractGeometry(convertMultiSurfaceTypeToJAXB(multiSurfaceType));
    } else if (geometry instanceof GeometryCollection) {
        MultiGeometryType multiGeometryType = convertToMultiGeometryType((GeometryCollection) geometry, srsName);
        geometryPropertyType.setAbstractGeometry(convertMultiGeometryTypeToJAXB(multiGeometryType));
    } else {
        throw new IllegalArgumentException();
    }
    return geometryPropertyType;
}
Also used : MultiPoint(com.vividsolutions.jts.geom.MultiPoint) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) MultiCurveType(net.opengis.gml.v_3_2_1.MultiCurveType) MultiGeometryType(net.opengis.gml.v_3_2_1.MultiGeometryType) PolygonType(net.opengis.gml.v_3_2_1.PolygonType) Point(com.vividsolutions.jts.geom.Point) MultiPoint(com.vividsolutions.jts.geom.MultiPoint) LineStringType(net.opengis.gml.v_3_2_1.LineStringType) MultiPointType(net.opengis.gml.v_3_2_1.MultiPointType) GeometryCollection(com.vividsolutions.jts.geom.GeometryCollection) MultiSurfaceType(net.opengis.gml.v_3_2_1.MultiSurfaceType) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) MultiPolygon(com.vividsolutions.jts.geom.MultiPolygon) PointType(net.opengis.gml.v_3_2_1.PointType) MultiPointType(net.opengis.gml.v_3_2_1.MultiPointType) MultiPolygon(com.vividsolutions.jts.geom.MultiPolygon) Polygon(com.vividsolutions.jts.geom.Polygon) GeometryPropertyType(net.opengis.gml.v_3_2_1.GeometryPropertyType)

Example 4 with LineStringType

use of ogc.schema.opengis.gml.v_2_1_2.LineStringType in project ddf by codice.

the class Wfs20JTStoGML321Converter method convertGeometryType.

private static LineStringType convertGeometryType(LineString lineString) {
    final LineStringType resultLineString = GML320_OBJECT_FACTORY.createLineStringType();
    for (DirectPositionType directPosition : convertCoordinates(lineString.getCoordinates())) {
        final JAXBElement<DirectPositionType> pos = GML320_OBJECT_FACTORY.createPos(directPosition);
        resultLineString.getPosOrPointPropertyOrPointRep().add(pos);
    }
    return resultLineString;
}
Also used : DirectPositionType(net.opengis.gml.v_3_2_1.DirectPositionType) LineStringType(net.opengis.gml.v_3_2_1.LineStringType)

Example 5 with LineStringType

use of ogc.schema.opengis.gml.v_2_1_2.LineStringType in project ddf by codice.

the class Wfs20JTStoGML321Converter method convertToLineStringType.

public static LineStringType convertToLineStringType(LineString line, String srsName) {
    LineStringType lineStringType = GML320_OBJECT_FACTORY.createLineStringType();
    CoordinatesType coordinatesType = GML320_OBJECT_FACTORY.createCoordinatesType();
    StringBuffer stringBuffer = new StringBuffer();
    for (int i = 0; i < line.getCoordinateSequence().size(); i++) {
        Coordinate coordinate = line.getCoordinateSequence().getCoordinate(i);
        if (i != 0) {
            stringBuffer.append(" ");
        }
        stringBuffer.append(coordinate.x).append(",").append(coordinate.y);
        if (!Double.isNaN(coordinate.z)) {
            stringBuffer.append(",").append(coordinate.z);
        }
    }
    coordinatesType.setValue(stringBuffer.toString());
    lineStringType.setCoordinates(coordinatesType);
    lineStringType.setSrsName(srsName);
    return lineStringType;
}
Also used : Coordinate(com.vividsolutions.jts.geom.Coordinate) LineStringType(net.opengis.gml.v_3_2_1.LineStringType) Point(com.vividsolutions.jts.geom.Point) MultiPoint(com.vividsolutions.jts.geom.MultiPoint) CoordinatesType(net.opengis.gml.v_3_2_1.CoordinatesType)

Aggregations

LineString (com.vividsolutions.jts.geom.LineString)5 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)5 LineStringType (net.opengis.gml.v_3_2_1.LineStringType)5 LineStringType (ogc.schema.opengis.gml.v_2_1_2.LineStringType)5 MultiLineStringType (ogc.schema.opengis.gml.v_2_1_2.MultiLineStringType)5 JAXBElement (javax.xml.bind.JAXBElement)3 Test (org.junit.Test)3 MultiPoint (com.vividsolutions.jts.geom.MultiPoint)2 Point (com.vividsolutions.jts.geom.Point)2 Coordinate (com.vividsolutions.jts.geom.Coordinate)1 GeometryCollection (com.vividsolutions.jts.geom.GeometryCollection)1 MultiPolygon (com.vividsolutions.jts.geom.MultiPolygon)1 Polygon (com.vividsolutions.jts.geom.Polygon)1 JAXBException (javax.xml.bind.JAXBException)1 CoordinatesType (net.opengis.gml.v_3_2_1.CoordinatesType)1 CurvePropertyType (net.opengis.gml.v_3_2_1.CurvePropertyType)1 DirectPositionType (net.opengis.gml.v_3_2_1.DirectPositionType)1 GeometryPropertyType (net.opengis.gml.v_3_2_1.GeometryPropertyType)1 MultiCurveType (net.opengis.gml.v_3_2_1.MultiCurveType)1 MultiGeometryType (net.opengis.gml.v_3_2_1.MultiGeometryType)1