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);
}
}
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;
}
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));
}
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);
}