Search in sources :

Example 1 with CrsId

use of org.geolatte.geom.crs.CrsId in project querydsl by querydsl.

the class AbstractConverterTest method getGeometries.

protected List<Geometry> getGeometries() {
    CrsId crs = CrsId.valueOf(1);
    List<Geometry> data = Lists.newArrayList();
    // points
    //        data.add(Points.createEmpty());
    data.add(Points.create2D(1, 2));
    data.add(Points.create2D(1, 2, crs));
    data.add(Points.create3D(1, 2, 3));
    data.add(Points.create3D(1, 2, 3, crs));
    data.add(Points.create2DM(1, 2, 3));
    data.add(Points.create2DM(1, 2, 3, crs));
    // linestring
    data.add(LineString.createEmpty());
    for (int i = 0; i < 6; i++) {
        data.add(new LineString(createSequence(crs, (Point) data.get(i), (Point) data.get(i))));
    }
    // polygon
    // TODO
    // multipoint
    data.add(MultiPoint.createEmpty());
    for (int i = 0; i < 6; i++) {
        data.add(new MultiPoint(new Point[] { (Point) data.get(i) }));
    }
    // multilinestring
    int size = data.size();
    data.add(MultiLineString.createEmpty());
    for (int i = 0; i < size; i++) {
        if (data.get(i) instanceof LineString) {
            data.add(new MultiLineString(new LineString[] { (LineString) data.get(i) }));
        }
    }
    // multipolygon
    data.add(MultiPolygon.createEmpty());
    for (int i = 0; i < size; i++) {
        if (data.get(i) instanceof Polygon) {
            data.add(new MultiPolygon(new Polygon[] { (Polygon) data.get(i) }));
        }
    }
    // collection
    size = data.size();
    for (int i = 0; i < size; i++) {
        data.add(new GeometryCollection(new Geometry[] { data.get(i) }));
    }
    for (String wkt : Connections.getSpatialData().values()) {
        data.add(Wkt.fromWkt(wkt));
    }
    return data;
}
Also used : CrsId(org.geolatte.geom.crs.CrsId)

Example 2 with CrsId

use of org.geolatte.geom.crs.CrsId in project querydsl by querydsl.

the class JGeometryConverter method convertMultiCurve.

// FIXME
private static MultiLineString convertMultiCurve(JGeometry geometry) {
    JGeometry[] elements = geometry.getElements();
    if (elements == null || elements.length == 0) {
        return MultiLineString.createEmpty();
    }
    CrsId crs = CrsId.valueOf(geometry.getSRID());
    LineString[] lineStrings = new LineString[elements.length];
    for (int i = 0; i < elements.length; i++) {
        PointSequence points = getPoints(elements[i]);
        lineStrings[i] = new LineString(points);
    }
    return new MultiLineString(lineStrings);
}
Also used : JGeometry(oracle.spatial.geometry.JGeometry) CrsId(org.geolatte.geom.crs.CrsId) Point(org.geolatte.geom.Point)

Example 3 with CrsId

use of org.geolatte.geom.crs.CrsId in project querydsl by querydsl.

the class PGgeometryConverter method convert.

private static Point convert(org.postgis.Point geometry) {
    int d = geometry.dimension;
    CrsId crs = CrsId.valueOf(geometry.srid);
    double[] point = new double[d + (geometry.haveMeasure ? 1 : 0)];
    int offset = 0;
    point[offset++] = geometry.x;
    point[offset++] = geometry.y;
    if (d == 3) {
        point[offset++] = geometry.z;
    }
    if (geometry.haveMeasure) {
        point[offset++] = geometry.m;
    }
    DimensionalFlag flag = DimensionalFlag.valueOf(d == 3, geometry.haveMeasure);
    return new Point(PointCollectionFactory.create(point, flag, crs));
}
Also used : CrsId(org.geolatte.geom.crs.CrsId)

Example 4 with CrsId

use of org.geolatte.geom.crs.CrsId in project querydsl by querydsl.

the class PGgeometryConverter method convertPoints.

private static PointSequence convertPoints(org.postgis.Point[] points) {
    if (points.length == 0) {
        return PointCollectionFactory.createEmpty();
    }
    org.postgis.Point first = points[0];
    CrsId crs = CrsId.valueOf(first.srid);
    DimensionalFlag flag = DimensionalFlag.valueOf(first.dimension == 3, first.haveMeasure);
    PointSequenceBuilder pointSequence = PointSequenceBuilders.variableSized(flag, crs);
    for (int i = 0; i < points.length; i++) {
        pointSequence.add(convert(points[i]));
    }
    return pointSequence.toPointSequence();
}
Also used : CrsId(org.geolatte.geom.crs.CrsId)

Example 5 with CrsId

use of org.geolatte.geom.crs.CrsId in project querydsl by querydsl.

the class JGeometryConverter method convertPoint.

private static Point convertPoint(JGeometry geometry) {
    CrsId crs = CrsId.valueOf(geometry.getSRID());
    double[] point = geometry.getPoint();
    int dimensions = geometry.getDimensions();
    boolean measured = geometry.isLRSGeometry();
    DimensionalFlag flag = DimensionalFlag.valueOf(dimensions > (measured ? 3 : 2), measured);
    return new Point(PointCollectionFactory.create(point, flag, crs));
}
Also used : CrsId(org.geolatte.geom.crs.CrsId) Point(org.geolatte.geom.Point) Point(org.geolatte.geom.Point)

Aggregations

CrsId (org.geolatte.geom.crs.CrsId)9 Point (org.geolatte.geom.Point)5 JGeometry (oracle.spatial.geometry.JGeometry)2