Search in sources :

Example 6 with LineStringType

use of org.geotoolkit.gml.xml.v321.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(org.locationtech.jts.geom.MultiPoint) MultiLineString(org.locationtech.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(org.locationtech.jts.geom.Point) MultiPoint(org.locationtech.jts.geom.MultiPoint) LineStringType(net.opengis.gml.v_3_2_1.LineStringType) MultiPointType(net.opengis.gml.v_3_2_1.MultiPointType) GeometryCollection(org.locationtech.jts.geom.GeometryCollection) MultiSurfaceType(net.opengis.gml.v_3_2_1.MultiSurfaceType) MultiLineString(org.locationtech.jts.geom.MultiLineString) LineString(org.locationtech.jts.geom.LineString) MultiPolygon(org.locationtech.jts.geom.MultiPolygon) PointType(net.opengis.gml.v_3_2_1.PointType) MultiPointType(net.opengis.gml.v_3_2_1.MultiPointType) Polygon(org.locationtech.jts.geom.Polygon) MultiPolygon(org.locationtech.jts.geom.MultiPolygon) GeometryPropertyType(net.opengis.gml.v_3_2_1.GeometryPropertyType)

Example 7 with LineStringType

use of org.geotoolkit.gml.xml.v321.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 8 with LineStringType

use of org.geotoolkit.gml.xml.v321.LineStringType in project ddf by codice.

the class WfsFilterDelegate method createLineString.

private JAXBElement<LineStringType> createLineString(Geometry geometry) {
    LineStringType lineStringType = gmlObjectFactory.createLineStringType();
    String coordinatesValue = coordinateStrategy.toString(geometry.getCoordinates());
    CoordinatesType coordinatesType = gmlObjectFactory.createCoordinatesType();
    coordinatesType.setValue(coordinatesValue);
    coordinatesType.setDecimal(".");
    coordinatesType.setCs(",");
    coordinatesType.setTs(" ");
    lineStringType.setCoordinates(coordinatesType);
    return gmlObjectFactory.createLineString(lineStringType);
}
Also used : LineString(org.locationtech.jts.geom.LineString) LineStringType(net.opengis.gml.v_3_1_1.LineStringType) CoordinatesType(net.opengis.gml.v_3_1_1.CoordinatesType)

Example 9 with LineStringType

use of org.geotoolkit.gml.xml.v321.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 10 with LineStringType

use of org.geotoolkit.gml.xml.v321.LineStringType in project OpenTripPlanner by opentripplanner.

the class ServiceLinkMapperTest method createServiceLink.

private ServiceLink createServiceLink(String id, double distance, Double[] coordinates) {
    DirectPositionListType directPositionListType = new DirectPositionListType().withValue(coordinates);
    LinkSequenceProjection linkSequenceProjection = new LinkSequenceProjection().withLineString(new LineStringType().withPosList(directPositionListType));
    JAXBElement<LinkSequenceProjection_VersionStructure> linkSequenceProjection_versionStructure = MappingSupport.createJaxbElement(linkSequenceProjection);
    Projections_RelStructure projections_relStructure = new Projections_RelStructure().withProjectionRefOrProjection(linkSequenceProjection_versionStructure);
    return new ServiceLink().withId(id).withDistance(new BigDecimal(distance)).withProjections(projections_relStructure);
}
Also used : LinkSequenceProjection(org.rutebanken.netex.model.LinkSequenceProjection) DirectPositionListType(net.opengis.gml._3.DirectPositionListType) Projections_RelStructure(org.rutebanken.netex.model.Projections_RelStructure) LinkSequenceProjection_VersionStructure(org.rutebanken.netex.model.LinkSequenceProjection_VersionStructure) ServiceLink(org.rutebanken.netex.model.ServiceLink) LineStringType(net.opengis.gml._3.LineStringType) BigDecimal(java.math.BigDecimal)

Aggregations

Test (org.junit.Test)11 LineString (org.locationtech.jts.geom.LineString)9 Coordinate (org.locationtech.jts.geom.Coordinate)7 ArrayList (java.util.ArrayList)6 JAXBElement (javax.xml.bind.JAXBElement)6 Geometry (org.locationtech.jts.geom.Geometry)6 LineStringType (net.opengis.gml._3.LineStringType)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 LineString (com.vividsolutions.jts.geom.LineString)4 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)4 List (java.util.List)4 DirectPositionListType (net.opengis.gml._3.DirectPositionListType)4 LineStringType (net.opengis.gml.v_3_1_1.LineStringType)3 LineStringType (org.geotoolkit.gml.xml.v311.LineStringType)3 MultiPoint (org.locationtech.jts.geom.MultiPoint)3 Point (org.locationtech.jts.geom.Point)3 BigDecimal (java.math.BigDecimal)2 TypeBuilder (ma.glasnost.orika.metadata.TypeBuilder)2