use of oracle.spatial.geometry.JGeometry in project querydsl by querydsl.
the class JGeometryConverterTest method polygon.
@Test
public void polygon() {
Polygon polygon = (org.geolatte.geom.Polygon) Wkt.fromWkt("POLYGON (" + "(30 10, 40 40, 20 40, 10 20, 30 10), " + "(20 30, 35 35, 30 20, 20 30))");
JGeometry geo = JGeometryConverter.convert(polygon);
double[] extRing = new double[] { 30, 10, 40, 40, 20, 40, 10, 20, 30, 10 };
double[] intRing = new double[] { 20, 30, 35, 35, 30, 20, 20, 30 };
JGeometry geo2 = JGeometry.createLinearPolygon(new Object[] { extRing, intRing }, polygon.getCoordinateDimension(), polygon.getSRID());
assertEquals(geo2, geo);
}
use of oracle.spatial.geometry.JGeometry in project querydsl by querydsl.
the class JGeometryConverterTest method roundTrip.
@Test
public void roundTrip() {
List<Geometry> geometries = getGeometries();
for (Geometry geometry : geometries) {
if (geometry instanceof MultiPolygon) {
continue;
}
if (geometry instanceof GeometryCollection) {
continue;
}
System.err.println(Wkt.toWkt(geometry));
JGeometry converted = JGeometryConverter.convert(geometry);
Geometry back = JGeometryConverter.convert(converted);
assertEquals(geometry, back);
}
}
use of oracle.spatial.geometry.JGeometry 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);
}
use of oracle.spatial.geometry.JGeometry in project querydsl by querydsl.
the class JGeometryConverter method convert.
private static JGeometry convert(MultiPoint geometry) {
int srid = geometry.getSRID();
int dim = geometry.getCoordinateDimension();
double[] points = getPoints(geometry.getPoints());
int[] elemInfo = new int[] { 1, 1, geometry.getNumPoints() };
int gtype = dim * 1000 + (geometry.isMeasured() ? dim : 0) * 100 + GTYPE_MULTIPOINT;
return new JGeometry(gtype, srid, elemInfo, points);
}
use of oracle.spatial.geometry.JGeometry in project querydsl by querydsl.
the class JGeometryConverter method convertMultiPolygon.
// FIXME
private static MultiPolygon convertMultiPolygon(JGeometry geometry) {
JGeometry[] elements = geometry.getElements();
if (elements == null || elements.length == 0) {
return MultiPolygon.createEmpty();
}
Polygon[] polygons = new Polygon[elements.length];
for (int i = 0; i < elements.length; i++) {
polygons[i] = convertPolygon(elements[i]);
}
return new MultiPolygon(polygons);
}
Aggregations