Search in sources :

Example 1 with Point

use of org.geolatte.geom.Point in project querydsl by querydsl.

the class JGeometryConverter method convert.

private static JGeometry convert(Point geometry) {
    double[] value = getCoordinates(geometry);
    int srid = geometry.getSRID();
    if (geometry.isMeasured()) {
        return JGeometry.createLRSPoint(value, value.length - 1, srid);
    } else {
        return JGeometry.createPoint(value, value.length, srid);
    }
}
Also used : Point(org.geolatte.geom.Point)

Example 2 with Point

use of org.geolatte.geom.Point in project querydsl by querydsl.

the class JGeometryConverter method getCoordinates.

private static double[] getCoordinates(Point geometry) {
    double[] value = new double[geometry.getCoordinateDimension()];
    int offset = 0;
    value[offset++] = geometry.getX();
    value[offset++] = geometry.getY();
    if (geometry.is3D()) {
        value[offset++] = geometry.getZ();
    }
    if (geometry.isMeasured()) {
        value[offset++] = geometry.getM();
    }
    return value;
}
Also used : Point(org.geolatte.geom.Point)

Example 3 with Point

use of org.geolatte.geom.Point 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)

Example 4 with Point

use of org.geolatte.geom.Point in project querydsl by querydsl.

the class JGeometryConverter method convertMultiPoint.

private static MultiPoint convertMultiPoint(JGeometry geometry) {
    CrsId crs = CrsId.valueOf(geometry.getSRID());
    JGeometry[] elements = geometry.getElements();
    if (elements == null || elements.length == 0) {
        return MultiPoint.createEmpty();
    }
    Point[] points = new Point[elements.length];
    int dimensions = geometry.getDimensions();
    double[] ordinates = geometry.getOrdinatesArray();
    boolean measured = geometry.isLRSGeometry();
    DimensionalFlag flag = DimensionalFlag.valueOf(dimensions > (measured ? 3 : 2), measured);
    int offset = 0;
    for (int i = 0; i < points.length; i++) {
        double[] coords = new double[dimensions];
        System.arraycopy(ordinates, offset, coords, 0, coords.length);
        points[i] = new Point(PointCollectionFactory.create(coords, flag, crs));
        offset += dimensions;
    }
    return new MultiPoint(points);
}
Also used : JGeometry(oracle.spatial.geometry.JGeometry) CrsId(org.geolatte.geom.crs.CrsId) Point(org.geolatte.geom.Point) Point(org.geolatte.geom.Point)

Aggregations

Point (org.geolatte.geom.Point)4 CrsId (org.geolatte.geom.crs.CrsId)2 JGeometry (oracle.spatial.geometry.JGeometry)1